Hi Ashley,

You can use the newForeignPtr the is exported from the Concurrent
module (in ghc 6.0), this function has the same signature as the
old haskell function.  When switching to ghc 6.0 I changed:

import Foreign.ForeignPtr

to:

import Foreign.ForeignPtr hiding (newForeignPtr,addForeignPtrFinalizer)
import Foreign.Concurrent

And everything kept working fine :-)


Hope this helps, (allthough it doesn't answer the question of why these
things have
changed or how to add parameters to the new newForeignPtr function,)

  -- Daan


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
> Behalf Of Ashley Yakeley
> Sent: zondag 13 juli 2003 10:15
> To: [EMAIL PROTECTED]
> Subject: More Finaliser Trouble
> 
> 
> 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
> 
> _______________________________________________
> FFI mailing list
> [EMAIL PROTECTED]
> http://www.haskell.org/mailman/listinfo/ffi
> 
> 


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

Reply via email to