More Finaliser Trouble
Ashley Yakeley
ashley at semantic.org
Sun Jul 13 04:15:09 EDT 2003
How do I pass a parameter to a finaliser? The pointer itself does not
have enough information to run the finaliser, I need an extra parameter
available at the time the pointer is created.
This was easy to do when I could write finalisers in Haskell, of course,
since I could just apply the parameter to my finaliser function to get a
finaliser that had the correct type. This is what it looked like:
foreign import ccall "JVMBridge.h JVMBridge_DeleteGlobalRefGC"
rawDeleteGlobalRefGC :: JavaVM -> RawGlobalRef -> IO ();
vm <- rawGetJavaVM ?jvmenv;
gref <- newForeignPtr rgref (rawDeleteGlobalRefGC vm
(MkRawGlobalRef rgref));
return (MkVMRef gref);
But with the new FFI I can't do this so easily. How would I pass the
'vm' parameter to a finaliser which is only allowed to look at the
'rgref' pointer?
--
Ashley Yakeley, Seattle WA
More information about the FFI
mailing list