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
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 mails | Author | Date |
|---|---|---|
| J. Todd Slack | May 3, 00:29 | |
| J. Todd Slack | May 3, 00:35 | |
| Jonathan Hess | May 3, 00:35 | |
| J. Todd Slack | May 3, 00:38 | |
| Nick Zitzmann | May 3, 00:54 | |
| Uli Kusterer | May 3, 01:04 | |
| Michael Vannorsdel | May 3, 01:31 | |
| J. Todd Slack | May 3, 01:33 | |
| Michael Vannorsdel | May 3, 01:36 | |
| Nick Zitzmann | May 3, 01:37 | |
| Graham Cox | May 3, 02:37 | |
| Brian Stern | May 3, 02:38 | |
| J. Todd Slack | May 3, 02:41 | |
| Jens Alfke | May 3, 03:15 | |
| Graham Cox | May 3, 03:19 | |
| Michael Ash | May 3, 04:40 | |
| Graham Cox | May 3, 04:50 | |
| Michael Ash | May 3, 05:58 | |
| Uli Kusterer | May 3, 12:59 | |
| Uli Kusterer | May 3, 13:01 | |
| Chris Hanson | May 3, 21:39 |






Cocoa mail archive

