开发者

importing c++ data types to haskell with ffi

I'm writing a haskell wrapper for a c++ library and as much as I can impo开发者_如何学Pythonrt 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜