how to link a minimal executable?
Greg Fitzgerald
garious at gmail.com
Wed Aug 11 17:31:50 EDT 2010
Is there any documentation or examples available that shows what needs to be
linked to get a haskell executable to print "hello world"? Instead of using
GHC to link, I'm interested in using gcc, ar, or link directly. For
starters, what implements the entry point?
$ cat Main.hs
main = print "hello world"
$ ghc -c Main.hs
$ Vs8/VC/bin/link.exe -NOLOGO Main.o
LINK : fatal error LNK1561: entry point must be defined
I see using ghc -v, it links all sorts of stuff:
$ ghc -v Main.hs
...
*** Linker:
...
-lHSrtsmain -lHShaskell98-1.0.1.1 -lHSrandom-1.0.0.2 -lHStime-1.1.4
-lHSprocess-1.0.1.2 -lHSdirectory-1.0.1.0 -lHSold-time-1.0.0.3
-lHSold-locale-1.0.0.2 -lHSfilepath-1.1.0.3 -lHSWin32-2.2.0.1 -luser32
-lgdi32 -lwinmm -ladvapi32 -lshell32 -lshfolder -lHSbytestring-0.9.1.5
-lHSarray-0.3.0.0 -lHSbase-4.2.0.0 -lwsock32 -luser32
-lshell32 -lHSinteger-simple-0.1.0.0 -lHSghc-prim-0.2.0.0 -lHSrts -lm
-lwsock32 -u _ghczmprim_GHCziTypes_Izh_static_info -u
_ghczmprim_GHCziTypes_Czh_static_info -u
_ghczmprim_GHCziTypes_Fzh_static_info -u
_ghczmprim_GHCziTypes_Dzh_static_info -u _base_GHCziPtr_Ptr_static_info -u
_base_GHCziWord_Wzh_static_info -u _base_GHCziInt_I8zh_static_info -u
_base_GHCziInt_I16zh_static_info -u _base_GHCziInt_I32zh_static_info -u
_base_GHCziInt_I64zh_static_info -u _base_GHCziWord_W8zh_static_info -u
_base_GHCziWord_W16zh_static_info -u _base_GHCziWord_W32zh_static_info -u
_base_GHCziWord_W64zh_static_info -u _base_GHCziStable_StablePtr_static_info
-u _ghczmprim_GHCziTypes_Izh_con_info -u _ghczmprim_GHCziTypes_Czh_con_info
-u _ghczmprim_GHCziTypes_Fzh_con_info -u _ghczmprim_GHCziTypes_Dzh_con_info
-u _base_GHCziPtr_Ptr_con_info -u _base_GHCziPtr_FunPtr_con_info -u
_base_GHCziStable_StablePtr_con_info -u _ghczmprim_GHCziBool_False_closure
-u _ghczmprim_GHCziBool_True_closure -u
_base_GHCziPack_unpackCString_closure -u
_base_GHCziIOziException_stackOverflow_closure -u
_base_GHCziIOziException_heapOverflow_closure -u
_base_ControlziExceptionziBase_nonTermination_closure -u
_base_GHCziIOziException_blockedIndefinitelyOnMVar_closure -u
_base_GHCziIOziException_blockedIndefinitelyOnSTM_closure -u
_base_ControlziExceptionziBase_nestedAtomically_closure -u
_base_GHCziWeak_runFinalizzerBatch_closure -u
_base_GHCziTopHandler_runIO_closure -u
_base_GHCziTopHandler_runNonIO_closure -u
_base_GHCziConc_ensureIOManagerIsRunning_closure -u
_base_GHCziConc_runSparks_closure -u _base_GHCziConc_runHandlers_closure
-lHSffiReading
Any insight would be greatly appreciated.
Thanks,
Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20100811/a3d6ae19/attachment.html
More information about the Glasgow-haskell-users
mailing list