
On 9/14/05, Simon Peyton-Jones
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.
Would someone like to write up a description of how to successfully call out from Haskell to C++ and vice versa, using GHC? If you did, we'd gladly include the result in the user manual, and save others a lot of head scratching. Maybe there are simple things we could do to GHC to make the process simpler. But what it needs is someone who knows C++ well to write a coherent story. Please!
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. 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... 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. -- Rich AIM : rnezzy ICQ : 174908475