On 9/14/05, <b class="gmail_sendername">Simon Peyton-Jones</b> &lt;<a href="mailto:simonpj@microsoft.com">simonpj@microsoft.com</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;">












<div>

<p><font color="blue" face="Verdana" size="2"><span style="font-size: 10pt; font-family: Verdana; color: blue;">There's been a bit of traffic
about calling Haskell from C++ recently, and I know that calling C++ from
Haskell is a frequently asked question.</span></font></p>







<p><font color="blue" face="Verdana" size="2"><span style="font-size: 10pt; font-family: Verdana; color: blue;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Would
someone like to write up a description of how<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to
successfully call out from Haskell to C++ and vice versa,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; using
GHC?&nbsp; </span></font></p><font color="blue" face="Verdana" size="2"><span style="font-size: 10pt; font-family: Verdana; color: blue;">If you did, we'd gladly include the
result in the user manual, and save others a lot of head scratching.&nbsp; Maybe
there are simple things we could do to GHC to make the process simpler.&nbsp;
But what it needs is someone who knows C++ well to write a coherent story.&nbsp;
Please!</span></font></div>





</blockquote></div><br clear="all">I'm flattered that you quoted my
message, but I'm not familiar with the foreign language interface; I
started looking at Haskell only a few weeks ago.<br>
<br>
I was able to fix the first problem, since the name-mangler is always a
problem when mixing other languages with C++. The second error I may or
may not have got right. The other solution recommended that the C++
library be linked which fixes the undefined exception handling symbols.
I'm curious what would happen if Haskell called down into C++ code and
then an exception was thrown...<br>
<br>
Anyways, I think your suggestion is a good one and I would be willing
to answer any C++ questions that anyone has when writing such a
document.<br>
<br>-- <br>Rich<br><br>AIM : rnezzy<br>ICQ : 174908475