Hello,
To access a haskell type from C code, do we have to make this type instance of Storable (and so to also define an homomorph structure on the C side), or does FFI specifies some C function to enable C code to access the fields, or even some GHC-specific functions? (Even if I'd prefer a portable way)
I mean, if I have the type:
data Character = Character {
pos :: (Float, Float),
size :: Float,
sprite :: Image
}
Do I compulsorily have to double its definition on C side:
stuct CCharacter {
float x;
float y;
float size;
Image sprite;
}
and then make Character instance of Storable, which will make the program *copy* Characters to CCharacters each time that I must call a C function to, say, draw a character?