More Finaliser Trouble
Ashley Yakeley
ashley at semantic.org
Wed Jul 16 04:19:59 EDT 2003
In article <ead7eb4e64962db8325e9305379508b3 at localhost.localdomain>,
Wolfgang Thaller <wolfgang.thaller at gmx.net> 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
More information about the FFI
mailing list