Fix RTS DLL references on Win64
authorIan Lynagh <igloo@earth.li>
Sun, 6 May 2012 14:54:13 +0000 (15:54 +0100)
committerIan Lynagh <igloo@earth.li>
Sun, 6 May 2012 14:54:13 +0000 (15:54 +0100)
includes/stg/DLL.h
rts/Linker.c
rts/win32/ThrIOManager.c

index ec64404..d23002a 100644 (file)
 #define __STGDLL_H__ 1
 
 #if defined(COMPILING_WINDOWS_DLL)
-#  define DLL_IMPORT_DATA_REF(x) (_imp__##x)
-#  define DLL_IMPORT_DATA_VARNAME(x) *_imp__##x
+#  if defined(x86_64_HOST_ARCH)
+#    define DLL_IMPORT_DATA_REF(x) (__imp_##x)
+#    define DLL_IMPORT_DATA_VARNAME(x) *__imp_##x
+#  else
+#    define DLL_IMPORT_DATA_REF(x) (_imp__##x)
+#    define DLL_IMPORT_DATA_VARNAME(x) *_imp__##x
+#  endif
 #  if __GNUC__ && !defined(__declspec)
 #    define DLLIMPORT
 #  else
 #    define DLLIMPORT __declspec(dllimport)
-#    define DLLIMPORT_DATA(x) _imp__##x
+#    if defined(x86_64_HOST_ARCH)
+#      define DLLIMPORT_DATA(x) __imp_##x
+#    else
+#      define DLLIMPORT_DATA(x) _imp__##x
+#    endif
 #  endif
 #else
 #  define DLL_IMPORT_DATA_REF(x) (&(x))
 #define DLL_IMPORT
 #define DLL_IMPORT_RTS DLLIMPORT
 # if defined(COMPILING_WINDOWS_DLL)
-#  define DLL_IMPORT_DATA_VAR(x) _imp__##x
+#  if defined(x86_64_HOST_ARCH)
+#   define DLL_IMPORT_DATA_VAR(x) __imp_##x
+#  else
+#   define DLL_IMPORT_DATA_VAR(x) _imp__##x
+#  endif
 # else
 #  define DLL_IMPORT_DATA_VAR(x) x
 # endif
index 26f734c..2899ee1 100644 (file)
@@ -1316,7 +1316,11 @@ typedef struct _RtsSymbolVal {
 #define SymI_NeedsProto(vvv)  extern void vvv(void);
 #if defined(COMPILING_WINDOWS_DLL)
 #define SymE_HasProto(vvv)    SymE_HasProto(vvv);
-#define SymE_NeedsProto(vvv)    extern void _imp__ ## vvv (void);
+#  if defined(x86_64_HOST_ARCH)
+#    define SymE_NeedsProto(vvv)    extern void __imp_ ## vvv (void);
+#  else
+#    define SymE_NeedsProto(vvv)    extern void _imp__ ## vvv (void);
+#  endif
 #else
 #define SymE_NeedsProto(vvv)  SymI_NeedsProto(vvv);
 #define SymE_HasProto(vvv)    SymI_HasProto(vvv)
index 234d4dc..41a1505 100644 (file)
@@ -153,7 +153,11 @@ ioManagerStart (void)
     if (io_manager_event == INVALID_HANDLE_VALUE) {\r
        cap = rts_lock();\r
 #if defined(COMPILING_WINDOWS_DLL)\r
+#  if defined(x86_64_HOST_ARCH)\r
+        rts_evalIO(&cap,__imp_base_GHCziConcziIO_ensureIOManagerIsRunning_closure,NULL);\r
+#  else\r
         rts_evalIO(&cap,_imp__base_GHCziConcziIO_ensureIOManagerIsRunning_closure,NULL);\r
+#  endif\r
 #else\r
         rts_evalIO(&cap,&base_GHCziConcziIO_ensureIOManagerIsRunning_closure,NULL);\r
 #endif\r