It is currently not, but I think it should be. Will update the FFI
spec to mention this issue.
--sigbjorn
> -----Original Message-----
> From: Sven Panne [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 22, 1999 15:41
> To: GHC Users
> Subject: Staying alive
>
>
> In a recent discussion with Manuel Chakravarty the following question
> arose. Given the following code:
>
> foo = do
> ba <- newMutableByteArray ...
> ...
> bar ba
> -- ba not used here anymore
>
> foreign import ... bar :: MutableByteArray ... -> IO ()
>
> Let's further assume that bar makes callbacks to Haskell-land where a
> GC occurs. Now the subtle question: Is it *guaranteed* that ba is
> considered alive until bar returns or not? Either way, this should be
> clarified in the FFI documentation.
>
> Background: A lot of APIs (e.g. GTK+ and OpenGL :-) have functions
> expecting a pointer to some data. One possible way to use them from
> Haskell is
>
> * malloc area
> * fill area with data
> * call API function with pointer to area
> * explicitly free malloced area
>
> Using (Mutable)ByteArrays would simplify thing here, especially the
> last step would not be needed.
>
> Cheers,
> Sven
> --
> Sven Panne Tel.:
> +49/89/2178-2235
> LMU, Institut fuer Informatik FAX :
> +49/89/2178-2211
> LFE Programmier- und Modellierungssprachen
> Oettingenstr. 67
> mailto:[EMAIL PROTECTED]
> D-80538 Muenchen
> http://www.informatik.uni-muenchen.de/~Sven.Panne
>