Re: Loading a .nib?
Re: Loading a .nib?
- Subject: Re: Loading a .nib?
- From: Chris Hanson <email@hidden>
- Date: Sat, 3 May 2008 12:39:15 -0700
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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden