Re: How does one use pass by reference functions using the ffi?

Alastair Reid <[email protected]> Sun, 25 Jan 2004 15:04:50 +0000
Newsgroups gmane.comp.lang.haskell.ffi
Organization Reid Consulting (UK) Ltd
Message-ID <[email protected]>
>   Say I have a function somewhere in c land with the following declaration:
>
> void doStuff( int &a, int &b);
>
>   What would the appropriate Haskell wrapper for this function look like?
> I'm looking to construct a haskell function of the type:

The following (untested) Greencard code ought to do the trick.

%fun doStuff :: Int -> Int -> IO (Int,Int)
%code doStuff(&arg1,&arg2)
%return ({*arg1},{*arg2})

--
Alastair Reid