diff -Nur libffi-3.0.8/Makefile.am dllize-3.0.8/Makefile.am --- libffi-3.0.8/Makefile.am 2008-02-21 13:36:18.000000000 +0000 +++ dllize-3.0.8/Makefile.am 2009-06-05 17:41:33.000000000 +0100 @@ -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.8/configure.ac dllize-3.0.8/configure.ac --- libffi-3.0.8/configure.ac 2008-12-19 16:12:30.000000000 +0000 +++ dllize-3.0.8/configure.ac 2009-06-05 17:41:33.000000000 +0100 @@ -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.8/include/ffi.h.in dllize-3.0.8/include/ffi.h.in --- libffi-3.0.8/include/ffi.h.in 2008-04-03 19:57:34.000000000 +0100 +++ dllize-3.0.8/include/ffi.h.in 2009-06-05 17:41:33.000000000 +0100 @@ -61,6 +61,17 @@ #define @TARGET@ #endif +#if @LIBFFI_DLL@ && !defined(LIBFFI_NOT_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 @@ -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.8/include/ffi_common.h dllize-3.0.8/include/ffi_common.h --- libffi-3.0.8/include/ffi_common.h 2008-07-12 06:43:00.000000000 +0100 +++ dllize-3.0.8/include/ffi_common.h 2009-06-05 17:41:33.000000000 +0100 @@ -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.8/src/x86/win32.S dllize-3.0.8/src/x86/win32.S --- libffi-3.0.8/src/x86/win32.S 2008-02-15 01:24:06.000000000 +0000 +++ dllize-3.0.8/src/x86/win32.S 2009-06-05 17:41:33.000000000 +0100 @@ -33,8 +33,6 @@ .text -.globl ffi_prep_args - # This assumes we are using gas. .balign 16 .globl _ffi_call_SYSV