
It's not usual, but it is allowed to have values of structs passed between functions directly instead of using pointers: (...)
Would it be possible to allow that in Haskell FFI (...)
There are a couple problems with this. First, the storage layout for a given C struct may be radically different depending on the back end,
When you say struct layout, do you mean the offset of diferent fields? I don't think this would be a problem, as your sugestion of hsc2hs is one of many solutions to that. I'm not sugesting that peek and poke methods of Storage instances should be created automatically, I understand this would not worth the effort. However, isn't just knowing the size and alignment enough to write a generic struct handler that, by using the appropriate calling convention, is going to work with any struct? If not, I agree with you it's really not worth it (as we can use pointers as Felipe sugested. Maurício