iron261 / openjpeg

Automatically exported from code.google.com/p/openjpeg
Other
0 stars 0 forks source link

stdcall convention for Windows targets #385

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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

Original issue reported on code.google.com by alex...@gmail.com on 30 Aug 2014 at 10:06

GoogleCodeExporter commented 9 years ago
Also: why on Earth did you guys switch to stdcall *at all*?

Original comment by LRN1...@gmail.com on 30 Aug 2014 at 11:20

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

Original comment by mathieu.malaterre on 7 Jan 2015 at 5:47

GoogleCodeExporter commented 9 years ago
Looks like mingw may prefer cdecl:

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

Original comment by mathieu.malaterre on 7 Jan 2015 at 5:49