Re: I now know why there's no binding to FTGL nor to GLTT

Sven Panne <[email protected]>
Newsgroups gmane.comp.lang.haskell.hopengl
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.