chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Chicken->Objective-C


From: Ed Watkeys
Subject: [Chicken-users] Chicken->Objective-C
Date: Sun, 19 Dec 2004 20:37:19 -0500

Hi,

As I was tediously writing wrappers for the CGxxx CoreGraphics functions, it hit me that there is an easier way to get access to Quartz 2D: through the Objective-C NSGraphicsContext class. Why, I asked myself, am I concentrating on churning out wrappers for a ton of individual functions when I could "simply" write an Objective-C bridge that would let me send messages to any object?

I started writing such a bridge, and here's some (hilariously simple) sample code:

(define pool (make_autorelease_pool))

; Let's get the description of the pool i.e. do this:
;
;   NSString *s = [pool description];
;   char *utf8 = [s UTF8String];

(define s (msg pool description))
(define utf8 (as_cstring (msg s UTF8String)))
(display utf8)
(newline)

(release pool)

Notice that I'm sending messages that take no arguments. That's because I haven't figured out how I want to send them to the glue. (Thus my message about new FFI techniques.) As soon as I figure out how to deal with the argument passing issue (feel free to make suggestions), I'll put the code somewhere interested parties can grab it.

Regards,
Ed

--
Watkeys Product Design -- http://watkeys.com/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]