Skip navigation.
 
mlRe: Loading a .nib?
FROM : Chris Hanson
DATE : Sat May 03 21:39:15 2008

On May 2, 2008, at 5:37 PM, Graham Cox wrote:

> is a Carbon app, so there is no Cocoa runtime available. You can use 
> a nib, but it has to be a Carbon one, so the functions you need to 
> look at are in the HIView family of Carbon functions.


It doesn't matter what Carbon app you're writing a plug-in for, you 
can use Cocoa.

You just need to ensure NSApplicationLoad() is called.  You can call 
it yourself in your plug-in before you try to use Cocoa:

<http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Miscellaneous/AppKit_Functions/Reference/reference.html#//apple_ref/c/func/NSApplicationLoad
>

The Objective-C runtime, the Cocoa frameworks, etc. will be pulled in 
as a side-effect of loading a plug-in that's linked against them. 
They aren't required to be linked from the main executable.

The only tricky thing you'll need to manage is if the main executable 
*unloads* plug-ins.  You have to ensure your plug-in is unloadable in 
that case, which can be subtle with Cocoa code.  For example, you'll 
want to pass -fno-constant-cfstrings to the compiler, and use 
CFSTR("foo") instead of @"foo" for string constants, to ensure that 
they're created at runtime rather than memory-mapped from your plug-in.

  -- Chris

Related mailsAuthorDate
mlLoading a .nib? J. Todd Slack May 3, 00:29
mlRe: Loading a .nib? J. Todd Slack May 3, 00:35
mlRe: Loading a .nib? Jonathan Hess May 3, 00:35
mlRe: Loading a .nib? J. Todd Slack May 3, 00:38
mlRe: Loading a .nib? Nick Zitzmann May 3, 00:54
mlRe: Loading a .nib? Uli Kusterer May 3, 01:04
mlRe: Loading a .nib? Michael Vannorsdel May 3, 01:31
mlRe: Loading a .nib? J. Todd Slack May 3, 01:33
mlRe: Loading a .nib? Michael Vannorsdel May 3, 01:36
mlRe: Loading a .nib? Nick Zitzmann May 3, 01:37
mlRe: Loading a .nib? Graham Cox May 3, 02:37
mlRe: Loading a .nib? Brian Stern May 3, 02:38
mlRe: Loading a .nib? J. Todd Slack May 3, 02:41
mlRe: Loading a .nib? Jens Alfke May 3, 03:15
mlRe: Loading a .nib? Graham Cox May 3, 03:19
mlRe: Loading a .nib? Michael Ash May 3, 04:40
mlRe: Loading a .nib? Graham Cox May 3, 04:50
mlRe: Loading a .nib? Michael Ash May 3, 05:58
mlRe: Loading a .nib? Uli Kusterer May 3, 12:59
mlRe: Loading a .nib? Uli Kusterer May 3, 13:01
mlRe: Loading a .nib? Chris Hanson May 3, 21:39