What's wrong with just doing this in the plain FFI?
foreign import ccall "getyx" getyx :: Ptr Window -> Ptr CInt -> Ptr CInt -> IO ()
Have I missed something?
You need at least one wrapper because getyx is a macro. Note that the arguments are ints _not_ int*s.
Aha! :-) Then I would probably write a C wrapper with the above type. Curious: how does green card know that getxy is a macro and that x and y are out parameters... do you have to tell it? Cheers, Simon
Curious: how does green card know that getxy is a macro and that x and y are out parameters... do you have to tell it?
More or less. GreenCard definitions are of the form of the form: %fun foo :: <type> ... %call <arbitrary C code to invoke foo> ... GreenCard fills in the obvious code (i.e., result = foo(args)) if you omit the %call line. Roughly speaking, you use %call lines in the same places that you'd introduce a wrapper in greencard. So you don't tell it that it's a macro but you do write a %call line and the code in the %call line will reflect the fact that you know it is a macro. -- Alastair Reid alastair@reid-consulting-uk.ltd.uk http://www.reid-consulting-uk.ltd.uk/alastair/
participants (2)
-
Alastair Reid -
Simon Marlow