FFI - closure, __stginit
Simon Marlow
simonmar@microsoft.com
Mon, 29 Jul 2002 11:27:11 +0100
> I'm just trying the ffi - importing some Haskell function=20
> into C. I've got a=20
> module "HelloWorld" with an exported function "add". And I got this=20
> "undefined reference" error while linking:
>=20
> undefined reference to `HelloWorld_zdfadd_closure'
>=20
> Can anybody please help me, what's wrong here?
>=20
> A second problem is the __stginit... function. I've defined=20
> void __stginit_HelloWorld (void) {}
> with an empty body. Is this o.k.? Or should I make ghc to=20
> generate it for me=20
> somehow?
It sounds like you're not linking the Haskell module into the binary.
The compiled Haskell code should provide both HelloWorld_zdfadd_closure
and __stginit_HelloWorld.
Cheers,
Simon