From: Ben.Lippmeier@anu.edu.au Date: Fri, 6 Nov 2009 06:27:32 +0000 (+0000) Subject: Break recursive imports between the RTS and base library on Windows. X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=02d8f553485ffe1b8bb8f131f9cf6a6ba0823b46 Break recursive imports between the RTS and base library on Windows. The file rts/win32/libHSbase.def contains a list of all the symbols from the base library that the RTS needs. When building the RTS into a DLL on Windows, we want to link the DLL for the RTS before we link the DLL for the base library. We use libHSbase.def to make the "import library" libHSbase.so.a, which contains stubs for each of the symbols from the base library that the RTS needs. --- diff --git a/rts/ghc.mk b/rts/ghc.mk index 25fcb4f..220103d 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -108,11 +108,23 @@ rts_$1_OBJS = $$(rts_$1_C_OBJS) $$(rts_$1_S_OBJS) $$(rts_$1_CMM_OBJS) rts_dist_$1_CC_OPTS += -DRtsWay=$$(DQ)rts_$1$$(DQ) + +# Making a shared library for the RTS. +# On Windows, as the RTS and base library has recursive imports +# we have to break the loop with a import library (libHSbase.so.a) +# This is made from rts/win32/libHSbase.def which contains a list of +# all the symbols in the base library used by the RTS. ifneq "$$(findstring dyn, $1)" "" $$(rts_$1_LIB) : $$(rts_$1_OBJS) rts/libs.depend "$$(RM)" $$(RM_OPTS) $$@ + ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32" + dlltool -d rts/win32/libHSbase.def -l rts/dist/build/win32/libHSbase.so.a + "$$(rts_dist_HC)" -shared -dynamic -dynload deploy \ + -no-auto-link-packages `cat rts/libs.depend` $$(rts_$1_OBJS) rts/dist/build/win32/libHSbase.so.a -o $$@ + else "$$(rts_dist_HC)" -shared -dynamic -dynload deploy \ -no-auto-link-packages `cat rts/libs.depend` $$(rts_$1_OBJS) -o $$@ + endif else $$(rts_$1_LIB) : $$(rts_$1_OBJS) "$$(RM)" $$(RM_OPTS) $$@ diff --git a/rts/win32/libHSbase.def b/rts/win32/libHSbase.def new file mode 100644 index 0000000..5f534e0 --- /dev/null +++ b/rts/win32/libHSbase.def @@ -0,0 +1,64 @@ + +LIBRARY base + +EXPORTS + + ffi_call + ffi_prep_cif + ffi_call + ffi_type_void + ffi_type_float + ffi_type_double + ffi_type_sint64 + ffi_type_uint64 + ffi_type_sint32 + ffi_type_uint32 + ffi_type_sint16 + ffi_type_uint16 + ffi_type_sint8 + ffi_type_uint8 + ffi_type_pointer + + ghczmprim_GHCziBool_True_closure + ghczmprim_GHCziBool_False_closure + ghczmprim_GHCziTypes_Czh_con_info + ghczmprim_GHCziTypes_Izh_con_info + ghczmprim_GHCziTypes_Fzh_con_info + ghczmprim_GHCziTypes_Dzh_con_info + ghczmprim_GHCziTypes_Czh_static_info + ghczmprim_GHCziTypes_Izh_static_info + + base_GHCziInt_I8zh_con_info + base_GHCziInt_I16zh_con_info + base_GHCziInt_I32zh_con_info + base_GHCziInt_I64zh_con_info + + base_GHCziWord_Wzh_con_info + base_GHCziWord_W8zh_con_info + base_GHCziWord_W16zh_con_info + base_GHCziWord_W32zh_con_info + base_GHCziWord_W64zh_con_info + + base_GHCziStable_StablePtr_con_info + + base_GHCziPack_unpackCString_closure + + base_GHCziTopHandler_runIO_closure + base_GHCziTopHandler_runNonIO_closure + + base_GHCziIOziException_stackOverflow_closure + base_GHCziIOziException_heapOverflow_closure + + base_GHCziPtr_Ptr_con_info + base_GHCziPtr_FunPtr_con_info + + base_GHCziWeak_runFinalizzerBatch_closure + base_GHCziPack_unpackCString_closure + base_GHCziIOziException_blockedIndefinitelyOnMVar_closure + base_GHCziIOziException_blockedIndefinitelyOnSTM_closure + base_GHCziIOziException_stackOverflow_closure + + base_ControlziExceptionziBase_nonTermination_closure + base_ControlziExceptionziBase_nestedAtomically_closure + +