ForeignObj and ForeignPtr

Sven Panne Sven.Panne at informatik.uni-muenchen.de
Tue May 1 10:41:23 EDT 2001


In the course of trying to find out GHC's status quo of typing foreign
declarations and scribbling together the forthcoming typing rules, I
stumbled over ForeignObj/ForeignPtr. There was a lively discussion about
this some time ago IIRC, but I'm unsure about a few things:

   * ForeignObj has been deprecated for a long time, but we should still
     keep it in the FFI for a transition time and pass the associated
     Addr when calling out, correct?

   * Does it make sense to allow ForeignObj/ForeignPtr as a prim_result?
     I think it doesn't, because the non-Haskell side can't know if and
     when the finaliser has been run.

   * What did we conclude about the lifetime rules? Should ForeignObj/ForeignPtr
     arguments be handled specially by the FFI or is {touch,with}Foreign{Obj,Ptr}
     required? I'd opt for the latter, but the current FFI docs seem to imply
     a special handling.   :-P   On the other hand, I can't see anything
     special in the code generated by GHC. Hmmm...

Cheers,
   Sven




More information about the FFI mailing list