Using hugsffi

Neil Mitchell ndmitchell at gmail.com
Wed Apr 26 12:29:57 EDT 2006


Hi,

I now can build ffihugs, and have added some patches so it finds
visual studio etc. I'm currently have ffihugs do something
"unexpected" - but I'm not sure what the real behaviour is...

-- test.hs
import Foreign
import System.Environment

main = print $ c_test 1 2


foreign import ccall unsafe "test.h test" c_test :: Int -> Int -> Int

-- test.c
int test(int a, int b){return 42;}

-- test.h
int test(int a, int b);

Then I run (as per http://cvs.haskell.org/Hugs/pages/users_guide/ffihugs.html):

ffihugs test.hs test.c

And before compiling hugs has clobbered test.c, and removed my code
from it. This gives a link error, since test is undefined.

Is this how ffihugs is supposed to work? Should my code be going somewhere else?

Thanks

Neil


More information about the Cvs-hugs mailing list