[Haskell-cafe] Re: Compiling a shared library on MacOS X
jdkoeck at gmail.com
Sun Jan 3 11:33:33 EST 2010
According to the manual, I have to use the -shared flag to compile a
But I get the following error:
link: GHC not built to link this way: LinkDynLib
Guess I have to recompile ghc !
2010/1/3 Jean-Denis Koeck <jdkoeck at gmail.com>
> I'm using the following cabal file to build a shared library with ghc:
> Build-Type: Simple
> Executable libmylibrary.dll
> If os(windows)
> CPP-Options: -DWIN32
> Extensions: ForeignFunctionInterface
> Build-Depends: ...
> Main-Is: libmylibrary.hs
> Ghc-Options: -W --make -no-hs-main -optl-shared -optl-s -O2
> The resulting library is called from a C++ graphical user interface (using
> which worked great so far on Windows and Linux.
> However, the compilation fails on MacOS X:
> Undefined symbols:
> "_ZCMain_main_closure", referenced from:
> _ZCMain_main_closure$non_lazy_ptr in libHSrts.a(Main.o)
> "___stginit_ZCMain", referenced from:
> ___stginit_ZCMain$non_lazy_ptr in libHSrts.a(Main.o)
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
> I don't know much about shared libraries, even less about them on MacOS X
> Any idea ?
> Jean-Denis Koeck
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe