FFI: calling Haskell from C++?

Felix Breuer felix at fbreuer.de
Wed Sep 14 14:08:42 EDT 2005

On Wed, 14 Sep 2005 16:05:26 +0100
"Simon Peyton-Jones" <simonpj at microsoft.com> wrote:

>           Would someone like to write up a description of how 
>           to successfully call out from Haskell to C++ and vice versa, 
>           using GHC?  

I could write up a summary of our experiences calling Haskell from C++,
but as I have no in depth knowledge of the interna, that summary would
be anything but comprehensive, so I am not sure I am the right man for
the job.

Right now we have to use GHC to link the entire project (including the
C++ part) because we have to rely on --make to figure out which GHC
libraries (i.e. which .o files in /usr/lib/ghc-6.4) we need to link
against. We would like to do the linking manually (via g++). Now:

 * Is there a way to have GHC link only the Haskell part of the project
   (including libraries) and create an .o file?
 * Alternatively: Is there a way to have GHC return dependency information
   _including_ information about GHC libs? (I know about -M but that does
   not include info about needed libraries)


More information about the Glasgow-haskell-users mailing list