On 9/13/05, <b class="gmail_sendername">Felix Breuer</b> &lt;<a href="mailto:felix@fbreuer.de">felix@fbreuer.de</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&nbsp; $ ghc -fffi Foo.o Foo_stub.o main.cpp<br>&nbsp;&nbsp;main.o(.text+0x22): In function `main':<br>&nbsp;&nbsp;main.cpp: undefined reference to `__stginit_Foo()'<br>&nbsp;&nbsp;main.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'<br>&nbsp;&nbsp;collect2: ld returned 1 exit status
<br>
</blockquote></div><br>In main.cpp, you need to define __stginit_Foo(void) like this:<br>
<br>
&nbsp;&nbsp;&nbsp; extern &quot;C&quot; void __stginit_Foo(void);<br clear="all"><br>
Specifying the &quot;C&quot; linkage with prevent the compiler from looking for a name-mangled version of the function.<br>
<br>
To fix the second problem, you need to shut off exception handling
(specifying the -fno-exceptions option ought to do this. I don't know
how to pass compiler option via ghc, though.<br>
<br>-- <br>Rich<br><br>AIM : rnezzy<br>ICQ : 174908475