Enable shared libraries on Windows; fixes trac #3879
authorIan Lynagh <igloo@earth.li>
Sat, 20 Mar 2010 23:14:14 +0000 (23:14 +0000)
committerIan Lynagh <igloo@earth.li>
Sat, 20 Mar 2010 23:14:14 +0000 (23:14 +0000)
mk/config.mk.in
rts/PrimOps.cmm
rts/RtsDllMain.c
rts/RtsDllMain.h [new file with mode: 0644]

index d3b656a..a640c3e 100644 (file)
@@ -102,7 +102,7 @@ GhcDebugged=NO
 GhcLibProfiled=$(if $(filter p,$(GhcLibWays)),YES,NO)
 
 # Do we support shared libs?
-PlatformSupportsSharedLibs = $(if $(filter $(TARGETPLATFORM),i386-unknown-linux x86_64-unknown-linux i386-unknown-freebsd amd64-unknown-freebsd),YES,NO)
+PlatformSupportsSharedLibs = $(if $(filter $(TARGETPLATFORM),i386-unknown-linux x86_64-unknown-linux i386-unknown-freebsd amd64-unknown-freebsd i386-unknown-mingw32),YES,NO)
 
 # ToDo later:
 # BuildStaticLibs=@BuildStaticLibs@
index bf81eee..4b5e106 100644 (file)
@@ -35,7 +35,9 @@ import base_ControlziExceptionziBase_nestedAtomically_closure;
 import EnterCriticalSection;
 import LeaveCriticalSection;
 import ghczmprim_GHCziBool_False_closure;
+#if !defined(mingw32_HOST_OS)
 import sm_mutex;
+#endif
 
 /*-----------------------------------------------------------------------------
   Array Primitives
index 3e5af68..592eb09 100644 (file)
@@ -9,6 +9,7 @@
 #include "PosixSource.h"
 #include "Rts.h"
 #include "RtsAPI.h"
+#include "RtsDllMain.h"
 
 #ifdef HAVE_WINDOWS_H
 #include <windows.h>
@@ -18,9 +19,9 @@
 #if defined(__PIC__) && defined(mingw32_TARGET_OS)
 BOOL
 WINAPI
-DllMain ( HINSTANCE hInstance
+DllMain ( HINSTANCE hInstance STG_UNUSED
         , DWORD reason
-       , LPVOID reserved
+       , LPVOID reserved STG_UNUSED
        )
 {
   /*
diff --git a/rts/RtsDllMain.h b/rts/RtsDllMain.h
new file mode 100644 (file)
index 0000000..df5fde9
--- /dev/null
@@ -0,0 +1,17 @@
+
+#include "Rts.h"
+
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+
+/* I'd be mildly surprised if this wasn't defined, but still. */
+#if defined(__PIC__) && defined(mingw32_TARGET_OS)
+BOOL
+WINAPI
+DllMain ( HINSTANCE hInstance
+        , DWORD reason
+       , LPVOID reserved
+       );
+#endif
+