How to access defines and enums in a convenient way?

2003-06-06 Thread Martin Norbäck
I am doing some wrappers for c functions, and I need to access defines, enums, and structs. I am doing this by writing access functions in c, so that I can call them from Haskell. Is there a way to write this c code inline in the Haskell module? Since any implementation of FFI must do this via C

Re: How to access defines and enums in a convenient way?

2003-06-06 Thread Sven Panne
Martin Norbäck wrote: I am doing some wrappers for c functions, and I need to access defines, enums, and structs. [...] Have a look at hsc2hs: http://haskell.org/ghc/docs/latest/html/users_guide/hsc2hs.html The hierachical libraries contain a lot of examples. But note that the generated

Re: How to access defines and enums in a convenient way?

2003-06-06 Thread Alastair Reid
You want to use a tool to make all this easier. There are various tools available: green-card, c2hs, and hsc2hs are the most commonly-used ones these days. Alastair Reid wrote a good comparison of the various tools (can't remember the link off hand though). It is in:

Re: How to access defines and enums in a convenient way?

2003-06-06 Thread Martin Norbäck
fre 2003-06-06 klockan 14.55 skrev Malcolm Wallace: Martin Norbäck [EMAIL PROTECTED] writes: hsc2hs solved my problem! It would be even greater if ghc --make could accept .hsc as source and not generate a .hs file at all, like it does with .lhs. Just a quick reminder that although 'ghc