Windows DLLs: add #ifdefery to turn off DLL import of libffi when building statically.
authorBen.Lippmeier@anu.edu.au <unknown>
Wed, 18 Nov 2009 04:39:01 +0000 (04:39 +0000)
committerBen.Lippmeier@anu.edu.au <unknown>
Wed, 18 Nov 2009 04:39:01 +0000 (04:39 +0000)
libffi/libffi.dllize-3.0.8.patch
rts/Interpreter.c

index 9967180..be9705d 100644 (file)
@@ -41,7 +41,7 @@ diff -Nur libffi-3.0.8/include/ffi.h.in dllize-3.0.8/include/ffi.h.in
  #define @TARGET@
  #endif
  
-+#if @LIBFFI_DLL@
++#if @LIBFFI_DLL@ && !defined(LIBFFI_NOT_DLL)
 +#ifdef DLL_EXPORT
 +#define __FFI_DECLSPEC __declspec(__dllexport__)
 +#else
index ea2064f..339d4d8 100644 (file)
 #include <errno.h>
 #endif
 
+// When building the RTS in the non-dyn way on Windows, we don't
+//     want declspec(__dllimport__) on the front of function prototypes
+//     from libffi.
+#if defined(mingw32_HOST_OS) && !defined(__PIC__)
+# define LIBFFI_NOT_DLL
+#endif
+
 #include "ffi.h"
 
 /* --------------------------------------------------------------------------