[Haskell-cafe] best way to deal with #defines when developing ffi's
johan.tibell at gmail.com
Wed Feb 23 07:14:32 CET 2011
On Tue, Feb 22, 2011 at 9:47 PM, <briand at aracnet.com> wrote:
> Hi all,
> I'm working on an FFI and as usual there are lots of defines in
> the header files.
> What's the best way to make these available to the haskell code ?
> Ideally it could be done automagically, or at least pseudo-magically so
> that keeping up with changes to the .h wouldn't be too painful.
> I'm talking about simple constant defines, nothing tricky like
> structures or similar.
If you use hsc2hs you should be able to refer to the C defines in your
Haskell code. Like so
where SO_REUSEPORT is a C define.
More information about the Haskell-Cafe