On Wed, Dec 15, 2004 at 04:09:04AM +0100, Sebastian Sylvan wrote:
> FMUSIC_MODULE * F_API FMUSIC_LoadSong(
> const char *name
> );
> 
> By doing this in Haskell:
> 
> data MusicModule = MusicModule
> 
> foreign import ccall "fmod.h FMUSIC_LoadSong" fmusic_LoadSong ::
> CString -> IO ForeignPtr MusicModule)
> 
> I assume that this is how the ForeignPtr is meant to be used (with a
> dummy data type).

No, a ForeignPtr is a purely haskell object.  The C function returns a
Ptr.  You could create a ForeignPtr from the Ptr if you want it to be
automatically freed (calling somesort of FreeSong, presumably) when it gets
garbage collected.
-- 
David Roundy
http://www.darcs.net
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to