[Openmcl-devel] Cocoa on Jaguar fix?
gb at clozure.com
Tue Sep 17 22:04:41 PDT 2002
On 17 Sep 2002, Doug McNaught wrote:
> I would like to get into Cocoa programming with OpenMCL, but I am
> running Jaguar and so I get the known failure that Gary posted about
> on the bug-openmcl list.
> 1. Is this perchance fixed in CVS?
Yes; there's a "news item" on the web page that announces that the fix
is in CVS, but I probably should have mentioned it here as well (and/or
replied to the bug report, "closing" it.)
> 2. I am trying to figure out how to fix it, but I don't know Cocoa or
> Objective-C very well yet, so it's slow going. It definitely
> appears that NSApplicationLoad() is necessary under Jaguar (though
> it may not be sufficient), but I'm not yet sure where it should be
> called. Any pointers would be appreciated.
>From what I can tell - NSApplicationLoad() doesn't seem to be documented
yet - it has something to do with starting the Cocoa event loop inside
a running Carbon application.
The Cocoa demo tries to do something different: it wants to dynamically
load the Cocoa libraries into a command-line program (the lisp), connect
to the window server (so that that program will have its own menubar,
dock icon, and window layer) and start the Cocoa event loop as if we'd
been launched by the Finder from inside a "bundle" directory ("OpenMCL.app",
in this case.)
In OS 10.1, one could fool the OS and Cocoa runtime system into doing
both of these things by clobbering "argv", (the first element of
the vector of C strings with which the OS called the OpenMCL kernel,
i.e., the full pathname of the application.)
That trick stopped working in 10.2 (I suppose that we should be glad
that it did ...). It'd be nice if there were documented ways of connecting
to the window system from a command-line program, but there don't seem
It occurred to me that Java programs face the same problem (connecting
to the OSX Window Server from a command-line program, as soon as AWT
or Swing or whatever gets instantiated), so I looked into how that worked.
The technique that the new, improved Cocoa demo uses isn't documented;
since it does the same thing that the Java VM does, I hope that it won't
break for a while.
> 3. If I can get it working, what's the best way to make sure the app
> still works in pre-Jaguar (which doesn't have NSApplicationLoad()
> from what I can see)?
I was able to verify that the new technique works under 10.1.5 as well
> Thanks for any help you can give!
I imagine that it'll be difficult (in some ways) to learn Cocoa from
the OpenMCL examples, if only because there's no real documentation
beyond the comments in the code. I hope that it's not impossible and
I hope that it gets better; any feedback anyone has would be appreciated.
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
Openmcl-devel mailing list
Openmcl-devel at clozure.com
More information about the Openmcl-devel