[plt-scheme] Re: [plt-dev] 64-Bit PLT Scheme for Windows/Mac

From: Andrew Reilly (andrew-scheme at areilly.bpc-users.org)
Date: Thu Oct 8 18:23:25 EDT 2009

On Wed, Oct 07, 2009 at 10:28:49AM +0200, Jakub Piotr Cłapa wrote:
> On 09-10-07 00:40, Andrew Reilly wrote:
> >[OT: I've been wondering how to deal with the change myself.  I
> >haven't met a description of how to call out to objective-C
> >methods from C, yet, only the other way around.  Anyone know of
> >a how-to or tutorial?  Or is the only approach to make a cocoa
> >application that calls back to the C "main" code somehow
> >(inverting the call graph).]
> You haven't seen any of these because it is not a problem. Code compiled 
> with an Objective-C compiler can define normal C procedures which use 
> Objective-C features but have normal linkage. Objective-C (contrary to 
> C++) is just some syntax sugar + runtime more than plain C.

I did a bit of reading after posting yesterday (wrong order I
know!) and was surprised to come to the same conclusion!  I must
have been burned by the C++ experience.

> Alternatively you can use the Objective-C runtime manually and send any 
> messages to any object you want. This is how the (quite new) PLT Scheme 
> Objective-C FFI works.

I haven't noticed that (objective-C FFI) yet.  Thanks for
pointing it out.  I'll give it a spin soon! [ For posterity: I
did find a nice neat description of the mechanism (using SEL
and IMP and associated functions) in this objective C FAQ:
http://www.thaesofereode.info/clocFAQ/ ]



Posted on the users mailing list.