[Haskell-cafe] Bulding a library for C users on OS X
chris at eidhof.nl
Mon Nov 2 05:21:53 EST 2009
On 2 nov 2009, at 03:30, Manuel M T Chakravarty wrote:
> Chris Eidhof:
>> I'm trying to call a Haskell function from C, on OS X. There's an
>> excellent post  by Tomáš Janoušek that explains how to do this
>> on Linux. However, on OS X, it's different. First of all, it looks
>> like the -no-hs-main flag is ignored, because I get the following
>> > ghc -O2 --make -no-hs-main -optl '-shared' -optc '-
>> DMODULE=Test' -o Test.so Test.hs module_init.c
>> > [1 of 1] Compiling Main ( Test.hs, Test.o )
>> > Test.hs:1:0: The function `main' is not defined in module `Main'''
> The flag -no-hs-main is a link-time flag that allows you to link
> without a main function, but you are getting a compile time error.
> It's as if you try to export main, but don't define it.
> Have you had a look at http://www.haskell.org/ghc/docs/latest/html/users_guide/ffi-ghc.html#foreign-export-ghc
Interesting! I didn't see that section before, thanks a lot.
More information about the Haskell-Cafe