[plt-scheme] Objective-C support for PLT Scheme
Hi all,
In the hope of eventually getting access to Cocoa on Mac OS X, I have
played a little with the FFI to get Objective C support. So far I have
managed to create Objective C objects and send them messages
from within PLT Scheme. See the small examples in objc.scm.
[Eli: Your FFI works great. The obj-send show that ffi-call came
in handy, so it is a good thing it is exported from lib/foreign]
What still eludes me is how to start a Cocoa application in the proper way.
I hope someone more knowledgable of Mac OS X can spot
what I am doing wrong. I suspect it is something simple.
In the "Creating a Cocoa application in Chicken" from
http://3e8.org/zb/cocoa/creating-a-cocoa-app.html
the NIB-file (an XML-file with information on the GUI) is loaded,
and run by calling NSApplicationMain.
When I try to copy the approach I keep getting the following error:
2008-07-17 16:19:12.372 mzscheme[61080:10b]
No Info.plist file in application bundle or
no NSPrincipalClass in the Info.plist file, exiting
Digging a little in Apples documentations one finds a simplified
version of NSApplicationMain:
int NSApplicationMain() {
/* Store an NSApplication instance in the global variable NSApp */
[NSApplication sharedApplication];
/* Lond the nib-file describing the GUI */
[NSBundle loadNibNamed:@"MainMenu" owner:NSApp];
/* Start the application */
[NSApp run];
}
Displaying the result (a zero) of
[NSBundle loadNibNamed:@"MainMenu" owner:NSApp];
shows that the bundle wasn't loaded.
The documentation of NSBundle says that one shouldn't give
that the full path to MainMenu.nib, but that the owner somehow
contains information on where to look for the bundle. I can't
figure out how though.
The files objc.scm and objc-support.scm are attached. If you
are interested in the source for the Currency Converter, send
me mail in order to get a tar-file.
--
Jens Axel Søgaard
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: objc-support.m
URL: <http://lists.racket-lang.org/users/archive/attachments/20080717/55b40f33/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: objc.scm
URL: <http://lists.racket-lang.org/users/archive/attachments/20080717/55b40f33/attachment-0001.ksh>