Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

importing c++ data types to haskell with ffi

I'm writing a haskell wrapper for a c++ library and as much as I can import functions from the library to my haskell program, I have no clue how to import c++ data types. For instance I have a function which takes as a parameter a video::E_DRIVER_TYPE EDT_OPENGL type defined in some.h file, and as I said before I know how to import the function with ffi using

foreign import ccall ...

with the appropriate compiler-mangled function name

but I'm not able to call the function from haskell because I can't figure out how to import/use this specific video driver data type.

Now, I know that you can create types in Haskell but still I need a starting point as to what to define the type to whatever the c++ representation is. (I'm confused at this point)

I would appreciate any kind of help! Thanks

like image 490
Adam Avatar asked Dec 05 '09 22:12

Adam


1 Answers

Calling C++ from Haskell is quite difficult; Haskell Wiki / Cxx foreign function interface lists some options.

like image 72
ephemient Avatar answered Oct 02 '22 20:10

ephemient