summarylogtreecommitdiffstats
path: root/bzip2-use-cdecl-calling-convention.patch
blob: c9b7f2838813531ddaa07eee858c45176f146c86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--- bzip2-1.0.5/bzlib.h	2007-12-09 13:34:39.000000000 +0100
+++ src/bzip2/1.0.5/bzip2-1.0.5/bzlib.h	2008-03-20 20:05:47.000000000 +0100
@@ -81,18 +81,52 @@
       /* windows.h define small to char */
 #      undef small
 #   endif
-#   ifdef BZ_EXPORT
-#   define BZ_API(func) WINAPI func
-#   define BZ_EXTERN extern
+//#   ifdef BZ_EXPORT
+//#   define BZ_API(func) WINAPI func
+//#   define BZ_EXTERN extern
+//#   else
+//   /* import windows dll dynamically */
+//#   define BZ_API(func) (WINAPI * func)
+//#   define BZ_EXTERN
+//#   endif
+//#else
+//#   define BZ_API(func) func
+//#   define BZ_EXTERN extern
+#   include <stdio.h>
+#   include <io.h>
+#   include <sys/utime.h>
+#   define fdopen		_fdopen
+#   define isatty		_isatty
+#   define setmode		_setmode
+#   define utime		_utime
+#   endif
+
+#ifndef __GNUC__
+# define __DLL_IMPORT__ __declspec(dllimport)
+# define __DLL_EXPORT__ __declspec(dllexport)
 #   else
-   /* import windows dll dynamically */
-#   define BZ_API(func) (WINAPI * func)
-#   define BZ_EXTERN
+# define __DLL_IMPORT__ __attribute__((dllimport)) extern
+# define __DLL_EXPORT__ __attribute__((dllexport)) extern
 #   endif
-#else
-#   define BZ_API(func) func
-#   define BZ_EXTERN extern
+
+#if (defined __WIN32__) || (defined _WIN32)
+# if defined BUILD_BZIP2_DLL  || defined BZ_EXPORT
+#  define BZIP2_DLL_IMPEXP __DLL_EXPORT__
+# elif defined(BZIP2_STATIC)
+#  define BZIP2_DLL_IMPEXP  
+# elif defined (USE_BZIP2_DLL) || defined BZ_IMPORT
+#  define BZIP2_DLL_IMPEXP __DLL_IMPORT__
+# elif defined (USE_BZIP2_STATIC)
+#  define BZIP2_DLL_IMPEXP   
+# else /* assume USE_BZIP2_DLL */
+#  define BZIP2_DLL_IMPEXP __DLL_IMPORT__
 #endif
+#else /* __WIN32__ */
+# define BZIP2_DLL_IMPEXP  
+#endif
+
+#define BZ_API(func) func
+#define BZ_EXTERN BZIP2_DLL_IMPEXP
 
 
 /*-- Core (low-level) library functions --*/