Re: More Finaliser Trouble

Ashley Yakeley <[email protected]>
Newsgroups gmane.comp.lang.haskell.ffi
Organization Myself
Message-ID <[email protected]>
In article <[email protected]>,
 Wolfgang Thaller <[email protected]> wrote:

> > Well now what if you want to pass two extra pointers? It's true you could 
> > "glue" them together [...]
> 
> Of course. That's what I have to do with all userData pointers I use in C,
> so if I use C finalizers, I'll put up with that...

The problem is that if you glue them together in Haskell using some 
tuple type, the native-code finaliser can't un-glue them without calling 
back into Haskell, which isn't in general allowed. So instead you have 
to call into native code to do the glue there.

For instance, my Java VM reference finaliser needs the reference to 
finalise and also a "JVM-pointer". So when I'm constucting these things 
in Haskell, I need to take the JVM pointer and the reference, and call 
some C function that allocates a little structure of the two and returns 
a pointer to it. Then I can make a ForeignPtr with that.

-- 
Ashley Yakeley, Seattle WA
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.