haskell / c2hs

c2hs is a pre-processor for Haskell FFI bindings to C libraries
http://hackage.haskell.org/package/c2hs
Other
198 stars 50 forks source link

#pragma pack not recognized #172

Open jchia opened 8 years ago

jchia commented 8 years ago

Although #pragma pack is not part of the C standard, the most popular compilers support it. Can we make c2hs also recognize it and process it properly so that structs defined under some #pragma pack can be have the correct layout in Haskell?

Specifically, the layout of certain structs can be different when using certain #pragma pack values, e.g. #pragma pack(1). If c2hs does not recognize #pragma pack, the layout it assumes will be different than what the C compiler uses.

There's #pragma pack (N), #pragma pack(push) and #pragma pack(pop).