[racket] Does the ffi/unsafe/objc require racket/gui/base to do things?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Jan 13 15:35:26 EST 2013

The `ffi/unsafe/objc' library does not depend on `racket/gui/base'.

But `racket/gui/base' initializes `NS...' libraries in various ways. In
particular, it causes the "Foundation" framework to be loaded, which is
needed for `(import-class NSAutoreleasePool)'.

You may want to use `ffi/unsafe/nsalloc'.

At Sun, 13 Jan 2013 13:19:08 -0700, Danny Yoo wrote:
> I'm playing with the Objective C bindings, and I'm encountering a
> behavior that I don't understand yet.  Given the following program:
> 
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;
> #lang racket/base
> (require ffi/unsafe/objc
>          ffi/unsafe)
> (import-class NSAutoreleasePool)
> (define pool (tell (tell NSAutoreleasePool alloc) init))
> pool
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;
> 
> 
> when I run this under DrRacket, I see values that do look ok.
> However, when I run this under plain console-based racket, I get #f
> back from everything.
> 
> If I force a graphical context by adding in a require to
> racket/gui/base, then the program above works as expected even in
> console Racket.  But is this supposed to happen this way?
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.