[Haskell-beginners] FFI for PBC - Windows and Nixes
Sumit Raja
sumitraja at gmail.com
Thu Jan 17 09:45:01 UTC 2019
Hi,
I am stuck with an odd problem that I don't know how to begin to
resolve. I have developed an FFI wrapper around the PBC library. I
have a number of tests thatcheck simple operations and some of the
more simple examples from the PBC C examples.
On FreeBSD and Linux (Mint) all tests pass successfully but on Windows
(mingw64) many fail with what look like data corruption errors. I
suspect it is something to do with alignment or size calculations but
I have no idea how to proceed.
The hsc file is fairly standard:
data PBCPairing = PBCPairing
data PBCElement = PBCElement
data PBCField = PBCField
data PBCPreProcElement = PBCPreProcElement
instance Storable PBCPairing where
sizeOf _ = #{size struct pairing_s}
alignment _ = #{alignment struct pairing_s}
peek = notImplemented
poke = notImplemented
instance Storable PBCElement where
sizeOf _ = #{size struct element_s}
alignment _ = #{alignment struct element_s}
peek = notImplemented
poke = notImplemented
instance Storable PBCPreProcElement where
sizeOf _ = #{size struct element_pp_s}
alignment _ = #{alignment struct element_pp_s}
peek = notImplemented
poke = notImplemented
instance Storable PBCField where
sizeOf _ = #{size struct field_s}
alignment _ = #{alignment struct field_s}
peek = notImplemented
poke = notImplemented
Generated sizeOf is the same and alignment is 8 across all OSes. I am
using inline-c for the FFI. PBC was built using msys2's version of
mingw64. All the C examples work correctly in the msys2 shell.
Does any one have any ideas on how best to approach this issue?
Thanks
Sumit
More information about the Beginners
mailing list