[Haskell-cafe] Wrapping a C++ library

Donn Cave donn at avvanta.com
Mon Jan 26 16:29:24 UTC 2015

Quoth Richard Lewis <richard.lewis at gold.ac.uk>,
> There's a specific question here which goes something like: how do I
> get hsc2hs to compile code that uses STL headers?

For me, that would be the first thing to fix.  Use #ifdef __cplusplus,
or just reorganize, so the hsc2hs-generated files are just C.
You wrote your wrapper library for the C++ part, and if the callers
need to be C++ it kind of defeats the purpose.

>From there, I would have guessed "extra-libraries: stdc++" would do it,
(assuming you have also arranged to get your wrapper library in there),
but I'm no cabal expert.  I use C++ more or less like you're doing, so 
there's hope, but I haven't gotten around to the cabal part of the


More information about the Haskell-Cafe mailing list