I have quite a few C structs structured like
typedef struct {
unsigned int a;
unsigned int b;
} StructA;
And a lot of functions like
void doSomethingWith(StructA*,StructB*,StructC*);
Is there an easy way to call these functions with Haskell FFI? Like, is there something that behaves like the & operator in C? (I imagine there isn't, but if there was I'd like to know). Do I have to make the Haskell side data
's instance of storeable (I don't have any constructor functions for these structs).
Also: If I have to pass a struct instead of a struct pointer (not a hypothetical question, I have a few functions like that - it's not my code so I can't do anything about it), can I just pass the components of the struct instead? Like if I want to call
void function(StructA);
can I do this with
foreign import ccall "function" :: CUInt -> CUInt -> IO()
?