ffihugs [+G] [option...] [+Lcc-option...] file
Suppose you have some C functions in test.c
and some ffi declarations for those functions in Test.hs
and the code in test.c needs to be
compiled with -lm.
To use these with Hugs, you must first use ffihugs
to generate Test.c, compile it and link it against
test.c with -lm to produce
Test.so:
ffihugs +G +L"test.c" +L"-lm" Test.hs |
(If
Test.hs depends on other ffi modules,
you'll have to compile them first.)
Now you can run Hugs as normal;
when
Test.hs is loaded,
Hugs will load
Test.so.)
and then use the imported or exported functions.