Re: Handle to haskell data
Alastair Reid <[email protected]> Mon, 1 Dec 2003 10:07:44 +0000
| Newsgroups | gmane.comp.lang.haskell.ffi |
|---|---|
| Organization | Reid Consulting (UK) Ltd |
| Message-ID | <[email protected]> |
On Sunday 30 November 2003 6:43 pm, David Waern 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++). Use StablePtrs. These are more or less a direct pointer to the Haskell data structure with just enough magic to keep the garbage collector happy. You can read more about StablePtrs in this paper: http://www.reid-consulting-uk.ltd.uk/alastair/publications/gfpw94/index.html Since that paper was written (1994), the names of the operations and their types has changed quite a bit. See the current specification for details: http://www.cse.unsw.edu.au/~chak/haskell/ffi/ -- Alastair Reid www.haskell-consulting.com