fix compilation and DLL creation of libopenjpeg with MSYS/MinGW (from vincent.torri...
authorAntonin Descampe <antonin@gmail.com>
Thu, 25 Nov 2010 11:58:26 +0000 (11:58 +0000)
committerAntonin Descampe <antonin@gmail.com>
Thu, 25 Nov 2010 11:58:26 +0000 (11:58 +0000)
CHANGES
libopenjpeg/event.c
libopenjpeg/j2k_lib.c
libopenjpeg/openjpeg.c
libopenjpeg/openjpeg.h
libopenjpeg/opj_malloc.h

diff --git a/CHANGES b/CHANGES
index 494d9dac605588455b3262aa20b047db1596dc9e..b47b7c8fea719f8d0050b49334f65204081bb047 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,9 @@ What's New for OpenJPEG
 ! : changed
 + : added
 
+November 25, 2010
+* [antonin] fix compilation and DLL creation of libopenjpeg with MSYS/MinGW (from vincent.torri, see issue 47 on googlecode)
+
 November 22, 2010
 ! [antonin] xcode : changed to native architecture build by default
 * [antonin] reverted 'include "../opj_config.h"' to 'include "opj_config.h"'
index 291ff58581142bec45d2e050edad218b4ca5a1cb..953a9973ebfb2025abf8a0e92ac29d765ad68927 100644 (file)
@@ -30,7 +30,7 @@
      Utility functions
    ==========================================================*/
 
-#if !defined(_MSC_VER) && !defined(__MINGW32__)
+#ifndef _WIN32
 static char*
 i2a(unsigned i, char *a, unsigned r) {
        if (i/r > 0) a = i2a(i/r,a,r);
@@ -57,7 +57,7 @@ _itoa(int i, char *a, int r) {
        return a;
 }
 
-#endif /* !WIN32 */
+#endif /* !_WIN32 */
 
 /* ----------------------------------------------------------------------- */
 
index 91aee0071521556bdc4edcbf19c280ceb92fe5f3..d815f166dd099817d8dcf535c3b04737ef2fff75 100644 (file)
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <windows.h>
 #else
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sys/times.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 #include "opj_includes.h"
 
 double opj_clock(void) {
-#ifdef WIN32
-       /* WIN32: use QueryPerformance (very accurate) */
+#ifdef _WIN32
+       /* _WIN32: use QueryPerformance (very accurate) */
     LARGE_INTEGER freq , t ;
     /* freq is the clock speed of the CPU */
     QueryPerformanceFrequency(&freq) ;
index 56c82f81db28f5830ba281fdc028dfe4c4ccfe3b..6722b33dcaf729642592302939a6a30531cff605 100644 (file)
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <windows.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include "opj_config.h"
 #include "opj_includes.h"
 
 /* ---------------------------------------------------------------------- */
-#ifdef WIN32
+#ifdef _WIN32
 #ifndef OPJ_STATIC
 BOOL APIENTRY
 DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
@@ -49,7 +49,7 @@ DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
     return TRUE;
 }
 #endif /* OPJ_STATIC */
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 /* ---------------------------------------------------------------------- */
 
index b2ade89c7c5fcda2bb93c74a5c9a83c9fed42191..101c7e8bd974ade3d8de1f9a3878f0bd06551bc4 100644 (file)
@@ -39,7 +39,7 @@
 ==========================================================
 */
 
-#if defined(OPJ_STATIC) || !(defined(WIN32) || defined(__WIN32__))
+#if defined(OPJ_STATIC) || !defined(_WIN32)
 #define OPJ_API
 #define OPJ_CALLCONV
 #else
@@ -52,12 +52,12 @@ that uses this DLL. This way any other project whose source files include this f
 OPJ_API functions as being imported from a DLL, wheras this DLL sees symbols
 defined with this macro as being exported.
 */
-#ifdef OPJ_EXPORTS
+#if defined(OPJ_EXPORTS) || defined(DLL_EXPORT)
 #define OPJ_API __declspec(dllexport)
 #else
 #define OPJ_API __declspec(dllimport)
 #endif /* OPJ_EXPORTS */
-#endif /* !OPJ_STATIC || !WIN32 */
+#endif /* !OPJ_STATIC || !_WIN32 */
 
 #ifndef __cplusplus
 #if defined(HAVE_STDBOOL_H)
index 1c99bcd54b3644a3fe4f95a5a6ce05f862bf6c72..64908f3e8c5bdff8cf3049cc00642329e931c1ed 100644 (file)
@@ -69,7 +69,7 @@ Allocate memory aligned to a 16 byte boundry
 @return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available\r
 */\r
 /* FIXME: These should be set with cmake tests, but we're currently not requiring use of cmake */\r
-#ifdef WIN32\r
+#ifdef _WIN32\r
        /* Someone should tell the mingw people that their malloc.h ought to provide _mm_malloc() */\r
        #ifdef __GNUC__\r
                #include <mm_malloc.h>\r
@@ -80,7 +80,7 @@ Allocate memory aligned to a 16 byte boundry
                        #define HAVE_MM_MALLOC\r
                #endif\r
        #endif\r
-#else /* Not WIN32 */\r
+#else /* Not _WIN32 */\r
        #if defined(__sun)\r
                #define HAVE_MEMALIGN\r
        /* Linux x86_64 and OSX always align allocations to 16 bytes */\r