Skip to content
Browse files

Fix RTS DLL references on Win64

  • Loading branch information...
1 parent 5872bf5 commit f09812ded085223d3f9dcb50c2c9cdc912984844 @igfoo igfoo committed May 6, 2012
Showing with 26 additions and 5 deletions.
  1. +17 −4 includes/stg/DLL.h
  2. +5 −1 rts/Linker.c
  3. +4 −0 rts/win32/ThrIOManager.c
View
21 includes/stg/DLL.h
@@ -15,13 +15,22 @@
#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))
@@ -46,7 +55,11 @@
#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
View
6 rts/Linker.c
@@ -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)
View
4 rts/win32/ThrIOManager.c
@@ -153,7 +153,11 @@ ioManagerStart (void)
if (io_manager_event == INVALID_HANDLE_VALUE) {
cap = rts_lock();
#if defined(COMPILING_WINDOWS_DLL)
+# if defined(x86_64_HOST_ARCH)
+ rts_evalIO(&cap,__imp_base_GHCziConcziIO_ensureIOManagerIsRunning_closure,NULL);
+# else
rts_evalIO(&cap,_imp__base_GHCziConcziIO_ensureIOManagerIsRunning_closure,NULL);
+# endif
#else
rts_evalIO(&cap,&base_GHCziConcziIO_ensureIOManagerIsRunning_closure,NULL);
#endif

0 comments on commit f09812d

Please sign in to comment.
Something went wrong with that request. Please try again.