GHCi and C++.

Duncan Coutts duncan.coutts at
Fri Feb 25 13:27:03 EST 2005

On Fri, 2005-02-25 at 19:05 +0100, Lemmih wrote:
> Greetings fellow Haskellers and other readers,
> During my ongoing research on "doing whatever I feel like", I
> discovered that using C++ libaries in GHCi (no problems with GHC)
> wasn't as pleasant as I had hoped.
> Apparently C++ sources requires to be linked with crtbegin.o and
> crtend.o (and others?) and I was wondering how to solve this nicely.
> Any hints or pointers would be greatly appreciated.

How about creating a dummy ghc package that has no Haskell code but
specifies all the nasty link time options. i.e. using the
extra_libraries, extra_ghc_opts, extra_cc_opts and extra_ld_opts fields.

Then when compiling your program you just use -package c++ or (-package
"cpp" or "cpp-support" if "c++" is not a valid package name). if you
make packages that depend on C++ support it's still easy, just make the
new package depend on the "cpp" package.


More information about the Glasgow-haskell-users mailing list