Re: Mixed Carbon/Cocoa Photoshop plugin unloadable?
Re: Mixed Carbon/Cocoa Photoshop plugin unloadable?
- Subject: Re: Mixed Carbon/Cocoa Photoshop plugin unloadable?
- From: Bob Ippolito <email@hidden>
- Date: Thu, 12 May 2005 08:40:39 -0400
On May 11, 2005, at 1:56 PM, Vincenzo Kreft-Kerekes wrote:
I’m writing a Photoshop plugin and had hoped to use Carbon for the
plugin calling interface and Cocoa for the UI and plugin operation
but Photoshop will crash upon executing a plugin that contains an
(unused) ObjC class, but not if the plugin merely links against the
Cocoa framework (which includes a reference in the Mach-O file).
I’ve looked at some of the shipped Photoshop plugins’ guts and most
of them link against the Cocoa framework and seem to be using some
CoreFoundation functionality.The plugin’s code is executed fine but
after returning to the calling process Photoshop will crash with a
dylib load error on a file that doesn’t physically exist anywhere.
I know the story about ObjC runtime utilizing bundles not being
unloadable from the calling process due to changes in the runtime
class structures but I would like to have someone’s opinion as to
whether this crashing behavior is most likely due to Photoshop
attempting to unload the plugin? Even though the ObjC class is not
being used by the Carbon code in the plugin at the moment, will its
presence cause an automatic load of the class structure once it’s
included in the Mach-O file? And given these limitations is there
anything from a Cocoa side that can be integrated into this plugin
or will I have to switch to using Carbon UI and plugin guts to make
the plugin unloadable?
The generic way to do this is to write a framework containing the
Objective-C code that is loaded by your bundle. This framework will
never get unloaded. You could probably do it with a bundle too, but
MH_DYLIB files are guaranteed to be loaded once.
Otherwise, Photoshop might have a special way to mark plugins that
define Objective-C classes and can't be unloaded, or maybe you can
have your plugin artificially increase its own reference count (if
Photoshop has such a scheme).
-bob
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden