[Haskell-cafe] FFI link failing due to no main?
phil at beadling.co.uk
phil at beadling.co.uk
Tue Aug 25 21:37:36 EDT 2009
Hi,
After creating my stub objects etc using GHC, I'm trying to create a
library with a C interface to some Haskell functions. I'm explicitly
passing in -no-hs-main yet the linker still fails due to missing main?
I'm sure I've had this working before with a slightly simpler example,
but can't work out what is wrong here.
If I give it a main (to humor it - it's not a solution), then it links
and produces an executable - so it looks to me like I'm not telling
the linker what I want correctly?
Any ideas?
Cheers,
Phil.
ghc -O2 --make -no-hs-main -package mtl -package array -optl '-
shared' FFI/Octave/MyInterface.c FFI/Octave/OptionInterface_stub.o FFI/
Octave/OptionInterface.o ./FrameworkInterface.o ./Maths/Prime.o ./
MonteCarlo/DataStructures.o ./MonteCarlo/European.o ./MonteCarlo/
Framework.o ./MonteCarlo/Interface.o ./MonteCarlo/Lookback.o ./Normal/
Acklam.o ./Normal/BoxMuller.o ./Normal/Framework.o ./Normal/
Interface.o ./Random/Framework.o ./Random/Halton.o ./Random/
Interface.o ./Random/Ranq1.o -o FFI/Octave/libMyInterface.so
Linking FFI/Octave/libMyInterface.so ...
Undefined symbols:
"___stginit_ZCMain", referenced from:
___stginit_ZCMain$non_lazy_ptr in libHSrts.a(Main.o)
"_ZCMain_main_closure", referenced from:
_ZCMain_main_closure$non_lazy_ptr in libHSrts.a(Main.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
More information about the Haskell-Cafe
mailing list