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

Enum (and enum define) auto-generated marshallers do not persist across modules #103

Closed abbradar closed 9 years ago

abbradar commented 10 years ago

If I use use #enum hooks like this:

{#enum my_enum as MyEnum {underscoreToCase} #}

{#fun unsafe my_func as ^ { `MyEnum' } -> `()' #}

This works as expected. If, though, I move #fun hook into separate module and use #import, then I get an error about unknown default marshaller. I suspect that this needs a change in interface files format.

ian-ross commented 10 years ago

@abbradar This is related to #97 and you're right, it will probably require changes to the interface file format. I'll try to do it for the next release but one (0.17.4).

ian-ross commented 9 years ago

@abbradar I think this is now fixed. Have a look at the test case (in tests/bugs/issue-103) and let me know if that corresponds to the problem you were seeing. Enum definitions are now persisted into the .chi interface files when C2HS is run on a .chs file, which was definitely missing before.

RyanGlScott commented 9 years ago

Does this also encompass #pointer types (from issue #97)?

ian-ross commented 9 years ago

@RyanGlScott Not yet. #97 is on my to-do list for tomorrow. I want to get that and #65 done before or over the weekend then do a new release.

abbradar commented 9 years ago

0.19.1 fixes this for me, thanks!