c2hs bind both typedef and function

70 views Asked by At

I am trying to properly create haskell bindings for function in C, that is split up in 2 files.

file1.h: typedef const char* fmi2GetTypesPlatformTYPE(void);

file2.h: __declspec(dllexport) fmi2GetTypesPlatformTYPE fmi2GetTypesPlatform;

To match this in Haskell I have created a similar structure, but this is where the trouble is.

file1.chs: type fmi2GetTypesPlatformTYPE = {#type fmi2GetTypesPlatformTYPE#}

How do I create a Haskell function pointer using this type? I have imported the file with {#import file1 #}, but I am lost on how to accomplish the last part.

See https://github.com/haskell/c2hs/issues/142 I will post the answer once resolved (unless Ian-ross beats me to it :) )

0

There are 0 answers