summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonin Descampe <antonin@gmail.com>2010-11-25 11:58:26 +0000
committerAntonin Descampe <antonin@gmail.com>2010-11-25 11:58:26 +0000
commit389166e86e14a3a09ccf3d28ca0ee64968c5de45 (patch)
tree484795d3ca90f83d4ba6eb7001098ac4622f0b7a
parent2b31495723e04ef79395c718b422d6fa6e6e1979 (diff)
fix compilation and DLL creation of libopenjpeg with MSYS/MinGW (from vincent.torri, see issue 47 on googlecode)
-rw-r--r--CHANGES3
-rw-r--r--libopenjpeg/event.c4
-rw-r--r--libopenjpeg/j2k_lib.c8
-rw-r--r--libopenjpeg/openjpeg.c8
-rw-r--r--libopenjpeg/openjpeg.h6
-rw-r--r--libopenjpeg/opj_malloc.h4
6 files changed, 18 insertions, 15 deletions
diff --git a/CHANGES b/CHANGES
index 494d9dac..b47b7c8f 100644
--- 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"'
diff --git a/libopenjpeg/event.c b/libopenjpeg/event.c
index 291ff585..953a9973 100644
--- a/libopenjpeg/event.c
+++ b/libopenjpeg/event.c
@@ -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 */
/* ----------------------------------------------------------------------- */
diff --git a/libopenjpeg/j2k_lib.c b/libopenjpeg/j2k_lib.c
index 91aee007..d815f166 100644
--- a/libopenjpeg/j2k_lib.c
+++ b/libopenjpeg/j2k_lib.c
@@ -24,18 +24,18 @@
* 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) ;
diff --git a/libopenjpeg/openjpeg.c b/libopenjpeg/openjpeg.c
index 56c82f81..6722b33d 100644
--- a/libopenjpeg/openjpeg.c
+++ b/libopenjpeg/openjpeg.c
@@ -24,15 +24,15 @@
* 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 */
/* ---------------------------------------------------------------------- */
diff --git a/libopenjpeg/openjpeg.h b/libopenjpeg/openjpeg.h
index b2ade89c..101c7e8b 100644
--- a/libopenjpeg/openjpeg.h
+++ b/libopenjpeg/openjpeg.h
@@ -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)
diff --git a/libopenjpeg/opj_malloc.h b/libopenjpeg/opj_malloc.h
index 1c99bcd5..64908f3e 100644
--- a/libopenjpeg/opj_malloc.h
+++ b/libopenjpeg/opj_malloc.h
@@ -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
*/
/* FIXME: These should be set with cmake tests, but we're currently not requiring use of cmake */
-#ifdef WIN32
+#ifdef _WIN32
/* Someone should tell the mingw people that their malloc.h ought to provide _mm_malloc() */
#ifdef __GNUC__
#include <mm_malloc.h>
@@ -80,7 +80,7 @@ Allocate memory aligned to a 16 byte boundry
#define HAVE_MM_MALLOC
#endif
#endif
-#else /* Not WIN32 */
+#else /* Not _WIN32 */
#if defined(__sun)
#define HAVE_MEMALIGN
/* Linux x86_64 and OSX always align allocations to 16 bytes */