GHCi and C++.

Lemmih lemmih at
Fri Feb 25 14:06:55 EST 2005

On Fri, 25 Feb 2005 18:27:03 +0000, Duncan Coutts
<duncan.coutts at> wrote:
> 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.

Thanks for replying and it all sounds nice, but I'm not sure which
linker options I'm missing since the location of the crt*.o files
appears to be implementation specific.


More information about the Glasgow-haskell-users mailing list