Hey all,

I'm trying to call a Haskell function from C, on OS X. There's an excellent post [1] 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 error:

> 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'

Second, I learned [2] that I have to pass in different flags on OS X, but unfortunately, GHC still wants me to have main. I'm probably doing something wrong here, is there anyone who can give me some pointers? (no pun intended).

I'm running GHC 6.10.2 on Leopard.

Thanks,
-chris

[1]: http://blog.haskell.cz/pivnik/building-a-shared-library-in-haskell/
[2]: 
http://www.mail-archive.com/haskell-cafe@haskell.org/msg51303.html_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to