On Tue, Nov 26, 2002 at 07:26:04PM +0100, Mauricio Carvalho wrote: > module MyModule where > foreign export ccall "fac" fac :: Int -> Int > fac :: Int -> Int > fac n > | n <= 0 = 1 > | otherwise = n * fac(n-1) > It gave me 4 files: MyModule_stub.h, MyModule_stub.c, MyModule_stub.o, MyModule.o >(and a MyModule.hi, but I think not relevant for linking with C)
You can use ghc to link your C programs and if that is an option, you strongly advised to do so. If you do it the hard way by calling the linker directly you have to specify all runtime modules for Haskell programs as well. For a quick hack, you can run ghc in verbose mode and see what it is linking in. The more thorough method is to look at a file called package.conf which includes details about what object files and what flags are used to do the linking. The package rts is the one which is included by default. Thus you would need to link the file HSrts and define all the symbols mentioned in order to use the normal linker to link a mixed Haskell C program. Hope this helps, Axel. _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
