Commit 5872bf59 authored by Ian Lynagh's avatar Ian Lynagh

Working towards fixing DLLs on Win64

parent 6dcf0012
......@@ -232,7 +232,7 @@ SchedulerStatus rts_getSchedStatus (Capability *cap);
// Note that RtsAPI.h is also included by foreign export stubs in
// the base package itself.
//
#if defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH) && defined(__PIC__) && !defined(COMPILING_BASE_PACKAGE)
#if defined(COMPILING_WINDOWS_DLL) && !defined(COMPILING_BASE_PACKAGE)
__declspec(dllimport) extern StgWord base_GHCziTopHandler_runIO_closure[];
__declspec(dllimport) extern StgWord base_GHCziTopHandler_runNonIO_closure[];
#else
......
......@@ -14,7 +14,7 @@
#ifndef __STGDLL_H__
#define __STGDLL_H__ 1
#if defined(__PIC__) && defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH)
#if defined(COMPILING_WINDOWS_DLL)
# define DLL_IMPORT_DATA_REF(x) (_imp__##x)
# define DLL_IMPORT_DATA_VARNAME(x) *_imp__##x
# if __GNUC__ && !defined(__declspec)
......@@ -45,7 +45,7 @@
#else
#define DLL_IMPORT
#define DLL_IMPORT_RTS DLLIMPORT
# if defined(__PIC__) && defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH)
# if defined(COMPILING_WINDOWS_DLL)
# define DLL_IMPORT_DATA_VAR(x) _imp__##x
# else
# define DLL_IMPORT_DATA_VAR(x) x
......
......@@ -986,7 +986,7 @@ typedef struct _RtsSymbolVal {
// We don't do this when compiling to Windows DLLs at the moment because
// it doesn't support cross package data references well.
//
#if defined(__PIC__) && defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH)
#if defined(COMPILING_WINDOWS_DLL)
#define RTS_INTCHAR_SYMBOLS
#else
#define RTS_INTCHAR_SYMBOLS \
......@@ -1314,7 +1314,7 @@ typedef struct _RtsSymbolVal {
/* entirely bogus claims about types of these symbols */
#define SymI_NeedsProto(vvv) extern void vvv(void);
#if defined(__PIC__) && defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH)
#if defined(COMPILING_WINDOWS_DLL)
#define SymE_HasProto(vvv) SymE_HasProto(vvv);
#define SymE_NeedsProto(vvv) extern void _imp__ ## vvv (void);
#else
......
......@@ -366,7 +366,7 @@ find_srt( stackPos *info )
bitmap = info->next.srt.srt_bitmap;
while (bitmap != 0) {
if ((bitmap & 1) != 0) {
#if defined(__PIC__) && defined(mingw32_HOST_OS)
#if defined(COMPILING_WINDOWS_DLL)
if ((unsigned long)(*(info->next.srt.srt)) & 0x1)
c = (* (StgClosure **)((unsigned long)*(info->next.srt.srt)) & ~0x1);
else
......@@ -1235,7 +1235,7 @@ retainSRT (StgClosure **srt, nat srt_bitmap, StgClosure *c, retainer c_child_r)
while (bitmap != 0) {
if ((bitmap & 1) != 0) {
#if defined(__PIC__) && defined(mingw32_HOST_OS)
#if defined(COMPILING_WINDOWS_DLL)
if ( (unsigned long)(*srt) & 0x1 ) {
retainClosure(* (StgClosure**) ((unsigned long) (*srt) & ~0x1),
c, c_child_r);
......
......@@ -16,7 +16,7 @@
#endif
/* I'd be mildly surprised if this wasn't defined, but still. */
#if defined(__PIC__) && defined(mingw32_HOST_OS)
#if defined(COMPILING_WINDOWS_DLL)
BOOL
WINAPI
DllMain ( HINSTANCE hInstance STG_UNUSED
......@@ -40,4 +40,4 @@ DllMain ( HINSTANCE hInstance STG_UNUSED
return TRUE;
}
#endif /* defined(__PIC__) && defined(mingw32_HOST_OS) */
#endif
......@@ -6,7 +6,7 @@
#endif
/* I'd be mildly surprised if this wasn't defined, but still. */
#if defined(__PIC__) && defined(mingw32_HOST_OS)
#if defined(COMPILING_WINDOWS_DLL)
BOOL
WINAPI
DllMain ( HINSTANCE hInstance
......
......@@ -576,7 +576,7 @@ INFO_TABLE_CONSTR(stg_MVAR_TSO_QUEUE,2,0,0,PRIM,"MVAR_TSO_QUEUE","MVAR_TSO_QUEUE
replace them with references to the static objects.
------------------------------------------------------------------------- */
#if defined(__PIC__) && defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH)
#if defined(COMPILING_WINDOWS_DLL)
/*
* When sticking the RTS in a Windows DLL, we delay populating the
* Charlike and Intlike tables until load-time, which is only
......@@ -601,7 +601,7 @@ INFO_TABLE_CONSTR(stg_MVAR_TSO_QUEUE,2,0,0,PRIM,"MVAR_TSO_QUEUE","MVAR_TSO_QUEUE
* on the fact that static closures live in the data section.
*/
#if !(defined(__PIC__) && defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH))
#if !(defined(COMPILING_WINDOWS_DLL))
section "data" {
stg_CHARLIKE_closure:
CHARLIKE_HDR(0)
......@@ -899,4 +899,4 @@ section "data" {
INTLIKE_HDR(16) /* MAX_INTLIKE == 16 */
}
#endif // !(defined(__PIC__) && defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH))
#endif
......@@ -134,6 +134,12 @@ rts_dist_$1_HC_OPTS = $$(GhcRtsHcOpts)
rts_dist_$1_CC_OPTS = $$(GhcRtsCcOpts)
endif
ifneq "$$(findstring dyn, $1)" ""
ifeq "$$(HostOS_CPP)" "mingw32"
rts_dist_$1_CC_OPTS += -DCOMPILING_WINDOWS_DLL
endif
endif
ifneq "$$(findstring thr, $1)" ""
rts_$1_EXTRA_C_SRCS = rts/dist/build/sm/Evac_thr.c rts/dist/build/sm/Scav_thr.c
endif
......
......@@ -555,7 +555,7 @@ loop:
//
case CONSTR_0_1:
{
#if defined(__PIC__) && defined(mingw32_HOST_OS)
#if defined(COMPILING_WINDOWS_DLL)
copy_tag_nolock(p,info,q,sizeofW(StgHeader)+1,gen_no,tag);
#else
StgWord w = (StgWord)q->payload[0];
......
......@@ -313,7 +313,7 @@ scavenge_srt (StgClosure **srt, nat srt_bitmap)
while (bitmap != 0) {
if ((bitmap & 1) != 0) {
#if defined(__PIC__) && defined(mingw32_HOST_OS)
#if defined(COMPILING_WINDOWS_DLL)
// Special-case to handle references to closures hiding out in DLLs, since
// double indirections required to get at those. The code generator knows
// which is which when generating the SRT, so it stores the (indirect)
......
......@@ -152,7 +152,7 @@ ioManagerStart (void)
Capability *cap;
if (io_manager_event == INVALID_HANDLE_VALUE) {
cap = rts_lock();
#if defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH) && defined(__PIC__)
#if defined(COMPILING_WINDOWS_DLL)
rts_evalIO(&cap,_imp__base_GHCziConcziIO_ensureIOManagerIsRunning_closure,NULL);
#else
rts_evalIO(&cap,&base_GHCziConcziIO_ensureIOManagerIsRunning_closure,NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment