[C2hs] Calling Convention

Manuel M T Chakravarty chak at cse.unsw.edu.au
Mon Apr 12 08:51:49 EDT 2010

Hi Trev,

> There was some noise a while back about adding support for foreign import conventions other than 'ccall'. Since the repo has disappeared from darcs.haskell.org, I was wondering if anything has come of this?
> http://haskell.org/pipermail/c2hs/2009-September/000971.html
> I essentially have the same problem at the moment, with a library that uses 'stdcall'. With a small amount of work, the header files can be convinced to output the appropriate C attribute, which language-c picks.
> If somebody can give me some guidelines of what module I should be looking at, I wouldn't mind trying to hack something together...

What platform are you using?  I'm not sure whether GHC supports stdcall on any platform except Windows.

As for making use of the C attributes (as Duncan suggested in the follow up to the message you cited), c2hs's code generation pass keeps track of called functions and the foreign import declarations that need to be generated.  You would probably need to extend that to keep track of the calling convention that you gleaned from the attribute, but it's probably easier if we talk about that directly.

Re the repo, we had to take it off darcs.haskell.org when that migrated to the new server.  I mean to put it up on code.haskell.org, but didn't get around to that.


More information about the C2hs mailing list