summaryrefslogtreecommitdiff
path: root/libffi/libffi.dllize-3.0.6.patch
blob: 6a19f1119d69974cf9b8a0e5e42ac30a1ecdf570 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
diff -Nur libffi-3.0.6/Makefile.am build/Makefile.am
--- libffi-3.0.6/Makefile.am	2008-02-21 13:36:18.000000000 +0000
+++ build/Makefile.am	2009-01-23 17:56:09.000000000 +0000
@@ -165,7 +165,7 @@
 
 AM_CFLAGS = -Wall -g -fexceptions
 
-libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
+libffi_la_LDFLAGS = $(LIBFFI_LDFLAGS) -version-info `grep -v '^\#' $(srcdir)/libtool-version`
 
 AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
 AM_CCASFLAGS = $(AM_CPPFLAGS)
diff -Nur libffi-3.0.6/configure.ac build/configure.ac
--- libffi-3.0.6/configure.ac	2008-07-17 13:57:33.000000000 +0100
+++ build/configure.ac	2009-01-23 17:56:09.000000000 +0000
@@ -26,6 +26,20 @@
 
 AM_PROG_AS
 AM_PROG_CC_C_O
+
+AC_LIBTOOL_WIN32_DLL
+AC_SUBST(LIBFFI_DLL,0)
+
+case $host in
+  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+    if test "$enable_shared" = yes; then
+      LIBFFI_LDFLAGS="-no-undefined -Wl,--export-all-symbols"
+      LIBFFI_DLL=1
+    fi
+    ;;
+esac
+AC_SUBST(LIBFFI_LDFLAGS)
+
 AC_PROG_LIBTOOL
 
 AM_MAINTAINER_MODE
diff -Nur libffi-3.0.6/include/ffi.h.in build/include/ffi.h.in
--- libffi-3.0.6/include/ffi.h.in	2008-04-03 19:57:34.000000000 +0100
+++ build/include/ffi.h.in	2009-01-23 17:56:09.000000000 +0000
@@ -61,6 +61,17 @@
 #define @TARGET@
 #endif
 
+#if @LIBFFI_DLL@
+#ifdef DLL_EXPORT
+#define __FFI_DECLSPEC __declspec(__dllexport__)
+#else
+#define __FFI_DECLSPEC __declspec(__dllimport__)
+#endif
+#else
+#define __FFI_DECLSPEC
+#endif
+
+
 /* ---- System configuration information --------------------------------- */
 
 #include <ffitarget.h>
@@ -223,27 +234,27 @@
 #endif
 
 
-void ffi_raw_call (ffi_cif *cif,
-		   void (*fn)(void),
-		   void *rvalue,
-		   ffi_raw *avalue);
-
-void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
-void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
-size_t ffi_raw_size (ffi_cif *cif);
+__FFI_DECLSPEC void ffi_raw_call (ffi_cif *cif,
+				  void (*fn)(void),
+				  void *rvalue,
+				  ffi_raw *avalue);
+
+__FFI_DECLSPEC void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
+__FFI_DECLSPEC void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
+__FFI_DECLSPEC size_t ffi_raw_size (ffi_cif *cif);
 
 /* This is analogous to the raw API, except it uses Java parameter	*/
 /* packing, even on 64-bit machines.  I.e. on 64-bit machines		*/
 /* longs and doubles are followed by an empty 64-bit word.		*/
 
-void ffi_java_raw_call (ffi_cif *cif,
-			void (*fn)(void),
-			void *rvalue,
-			ffi_java_raw *avalue);
-
-void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
-void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
-size_t ffi_java_raw_size (ffi_cif *cif);
+__FFI_DECLSPEC void ffi_java_raw_call (ffi_cif *cif,
+				       void (*fn)(void),
+				       void *rvalue,
+				       ffi_java_raw *avalue);
+
+__FFI_DECLSPEC void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
+__FFI_DECLSPEC void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
+__FFI_DECLSPEC size_t ffi_java_raw_size (ffi_cif *cif);
 
 /* ---- Definitions for closures ----------------------------------------- */
 
@@ -256,16 +267,16 @@
   void      *user_data;
 } ffi_closure __attribute__((aligned (8)));
 
-void *ffi_closure_alloc (size_t size, void **code);
-void ffi_closure_free (void *);
+__FFI_DECLSPEC void *ffi_closure_alloc (size_t size, void **code);
+__FFI_DECLSPEC void ffi_closure_free (void *);
 
-ffi_status
+__FFI_DECLSPEC ffi_status
 ffi_prep_closure (ffi_closure*,
 		  ffi_cif *,
 		  void (*fun)(ffi_cif*,void*,void**,void*),
 		  void *user_data);
 
-ffi_status
+__FFI_DECLSPEC ffi_status
 ffi_prep_closure_loc (ffi_closure*,
 		      ffi_cif *,
 		      void (*fun)(ffi_cif*,void*,void**,void*),
@@ -314,26 +325,26 @@
 
 } ffi_java_raw_closure;
 
-ffi_status
+__FFI_DECLSPEC ffi_status
 ffi_prep_raw_closure (ffi_raw_closure*,
 		      ffi_cif *cif,
 		      void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
 		      void *user_data);
 
-ffi_status
+__FFI_DECLSPEC ffi_status
 ffi_prep_raw_closure_loc (ffi_raw_closure*,
 			  ffi_cif *cif,
 			  void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
 			  void *user_data,
 			  void *codeloc);
 
-ffi_status
+__FFI_DECLSPEC ffi_status
 ffi_prep_java_raw_closure (ffi_java_raw_closure*,
 		           ffi_cif *cif,
 		           void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
 		           void *user_data);
 
-ffi_status
+__FFI_DECLSPEC ffi_status
 ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
 			       ffi_cif *cif,
 			       void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
@@ -344,16 +355,16 @@
 
 /* ---- Public interface definition -------------------------------------- */
 
-ffi_status ffi_prep_cif(ffi_cif *cif,
-			ffi_abi abi,
-			unsigned int nargs,
-			ffi_type *rtype,
-			ffi_type **atypes);
-
-void ffi_call(ffi_cif *cif,
-	      void (*fn)(void),
-	      void *rvalue,
-	      void **avalue);
+__FFI_DECLSPEC ffi_status ffi_prep_cif(ffi_cif *cif,
+				       ffi_abi abi,
+				       unsigned int nargs,
+				       ffi_type *rtype,
+				       ffi_type **atypes);
+
+__FFI_DECLSPEC void ffi_call(ffi_cif *cif,
+			     void (*fn)(void),
+			     void *rvalue,
+			     void **avalue);
 
 /* Useful for eliminating compiler warnings */
 #define FFI_FN(f) ((void (*)(void))f)
diff -Nur libffi-3.0.6/include/ffi_common.h build/include/ffi_common.h
--- libffi-3.0.6/include/ffi_common.h	2008-07-12 06:43:00.000000000 +0100
+++ build/include/ffi_common.h	2009-01-23 17:56:09.000000000 +0000
@@ -49,9 +49,9 @@
 #endif
 
 #ifdef FFI_DEBUG
-void ffi_assert(char *expr, char *file, int line);
-void ffi_stop_here(void);
-void ffi_type_test(ffi_type *a, char *file, int line);
+__FFI_DECLSPEC void ffi_assert(char *expr, char *file, int line);
+__FFI_DECLSPEC void ffi_stop_here(void);
+__FFI_DECLSPEC void ffi_type_test(ffi_type *a, char *file, int line);
 
 #define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
 #define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
@@ -66,7 +66,7 @@
 #define ALIGN_DOWN(v, a) (((size_t) (v)) & -a)
 
 /* Perform machine dependent cif processing */
-ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
+__FFI_DECLSPEC ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
 
 /* Extended cif, used in callback from assembly routine */
 typedef struct
diff -Nur libffi-3.0.6/src/x86/win32.S build/src/x86/win32.S
--- libffi-3.0.6/src/x86/win32.S	2008-02-15 01:24:06.000000000 +0000
+++ build/src/x86/win32.S	2009-01-23 17:56:09.000000000 +0000
@@ -33,8 +33,6 @@
  
 .text
  
-.globl ffi_prep_args
- 
         # This assumes we are using gas.
         .balign 16
 .globl _ffi_call_SYSV