Using GHC and FFI

Dominik Oesterreich dominik at oesterreichnet.de
Thu Jul 15 14:15:27 EDT 2004


Hello,
 
I try to use the FFI, but it doesn't work.
 
I write:
 
int test (void)
{
    return 2;
}
 
and compiled this. So I created a file named project.obj.
 
Then I wrote a Lhs File named test.lhs
>module Blah where

>import Foreign.C.Types(CInt)
>foreign import ccall test :: CInt

>blah = test

 

After that I wrote ghc -fffi -c test.lhs. But when I call blah from ghci
I get the error message: "test.o unknown symbol '_test'

I think ghc doen't link test.o to projekt.obj. What do I have to do? 

Thx

 

Dominik

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org//pipermail/glasgow-haskell-users/attachments/20040715/040785e4/attachment-0001.htm


More information about the Glasgow-haskell-users mailing list