[prev in list] [next in list] [prev in thread] [next in thread]
List: racket-users
Subject: [racket] FFI: Casting pointers
From: mflatt () cs ! utah ! edu (Matthew Flatt)
Date: 2012-01-23 14:12:34
Message-ID: 20120123141236.05F366500A8 () mail-svr1 ! cs ! utah ! edu
[Download RAW message or body]
Although discussion has moved on to better solutions...
At Sun, 22 Jan 2012 14:14:47 -0700, Michael W wrote:
> If I say:
>
> (cast
> (malloc _OggVorbis_File)
> _pointer _OggVorbis_File-pointer)
>
> ...That's bad -- because I never keep the original pointer
> returned by the (malloc) call, the garbage collector reclaims
> that memory even though the _OggVorbis_File-pointer still points
> to it.
To fix this cast, use `_gcpointer' as the source type and `_gcable' on
the result pointer type:
(cast
(malloc _OggVorbis_File)
_gcpointer
(_gcable _OggVorbis_File-pointer))
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic