[Haskell-cafe] FFI woes!
droundy at abridgegame.org
Wed Dec 15 06:04:37 EST 2004
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
More information about the Haskell-Cafe