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


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

链接地址: http://www.djcxy.com/p/61172.html

上一篇: 联盟和类型**与Haskell FFI?

下一篇: 使用ffi将c ++数据类型导入haskell