Export to GitHub

openjpeg - issue #385

stdcall convention for Windows targets


Posted on Aug 30, 2014 by Happy Ox

openjpeg.h have issue with defining std call for Windows. It need to be declared for static builds too. Patch:

--- openjpeg-2.1.0/src/lib/openjp2/openjpeg.h.orig 2014-04-29 11:15:02.000000000 +0400 +++ openjpeg-2.1.0/src/lib/openjp2/openjpeg.h 2014-08-31 00:25:32.771200000 +0400 @@ -76,6 +76,12 @@ #define OPJ_DEPRECATED(func) func #endif

+#if defined(_WIN32) +#define OPJ_CALLCONV stdcall +#else +#define OPJ_CALLCONV +#endif + #if defined(OPJ_STATIC) || !defined(_WIN32) /* http://gcc.gnu.org/wiki/Visibility / #if __GNUC >= 4 @@ -85,9 +91,7 @@ #define OPJ_API #define OPJ_LOCAL #endif -#define OPJ_CALLCONV #else -#define OPJ_CALLCONV __stdcall / The following ifdef block is the standard way of creating macros which make exporting from a DLL simpler. All files within this DLL are compiled with the OPJ_EXPORTS @@ -101,7 +105,7 @@ #else #define OPJ_API __declspec(dllimport) #endif /* OPJ_EXPORTS / -#endif / !OPJ_STATIC || !_WIN32 / +#endif / OPJ_STATIC || !_WIN32 */

typedef int OPJ_BOOL; #define OPJ_TRUE 1

Comment #1

Posted on Aug 30, 2014 by Happy Wombat

Also: why on Earth did you guys switch to stdcall at all?

Comment #2

Posted on Jan 7, 2015 by Helpful Giraffe

I am ok to apply the patch as is but instead can we switch to __cdecl ? What would be the consequences ?

Comment #3

Posted on Jan 7, 2015 by Helpful Giraffe

Looks like mingw may prefer cdecl:

http://stackoverflow.com/a/6635067/136285

Status: New

Labels:
Type-Defect Priority-Medium