[HOpenGL] I now know why there's no binding to FTGL nor to GLTT

Sven Panne Sven_Panne@BetaResearch.de
Wed, 24 Jul 2002 14:20:05 +0200


Nick Name wrote:
> [...] Is there a way? I really don't know anything about calling C++
> from C. Is there some way to make haskell bindings for a C++ library?
> Am I stuck in a dead end? Already?

The current FFI doesn't support C++, nevertheless there is a slightly
tedious, but doable way around this: Write a thin wrapper with C linkage
around the C++ stuff, using your favourite C++ compiler, e.g.

   extern "C" double foo(int x) { ... }

is callable via the normal

   foreign import ccall foo :: CDouble -> CInt

(add "unsafe" or IO, depending on the nature of foo).

Cheers,
   S.