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

_______________________________________________
FFI mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/ffi

Reply via email to