Handle to haskell data

Fergus Henderson fjh at cs.mu.oz.au
Sun Nov 30 16:47:28 EST 2003


On 30-Nov-2003, David Waern <davve at dtek.chalmers.se> wrote:
> 
> Hi. I want to know if it is possible via FFI and GHC to allocate
> haskell data structures and return some kind of handle to their internal
> representation in the haskell runtime to another language that calls
> haskell code (c/c++).

I haven't tried it myself, but I think the answer is yes:
use the StablePtr type, which in C is the HsStablePtr typedef in "HsFFI.h".

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.


More information about the FFI mailing list