Re: Carbon app and Cocoa/Carbon Bundle plugin - possible?!
Re: Carbon app and Cocoa/Carbon Bundle plugin - possible?!
- Subject: Re: Carbon app and Cocoa/Carbon Bundle plugin - possible?!
- From: Igor Delovski <email@hidden>
- Date: Wed, 19 Jun 2013 02:29:51 -0700 (PDT)
Thanks for the info,
So it seems I was lucky so far, even though I didn't even know
CFBundleUnloadExecutable() existed, I was unloading things with
the simple CFRelease().
I use these plugins for custom printing and custom imports/exports.
Now I need to talk to a web service and use JSON and I have no idea
how to do it in Carbon so I need Cocoa for that.
My whole plugin system originated on OS9 (and OS7, 8) where I
couldn't do much in there since global variables were not allowed.
Couldn't even link to libraries because most of them used at least
a few.
Thats's why I exposed everything from the main application to the
plugin via function pointers. Even strcpy(), printf(), everything from
the Mac Toolbox and my own stuff that I needed in plugin.
My main app had somewhere initialization like this:
pinData->sys->p_strcpy = strcpy;
...
pinData->app->p_drawPic = id_drawPic;
and in my plugin I had defines like these:
#define strcpy pinSys->p_strcpy
#define id_drawPic pinApp->p_drawPic
This way plugins could do almost anything. At some point I moved
it all to Windows and DLLs and later to OSX. The code in
plugins looked normal, portable, copy/pastable from the main app
to plugin and back, but it was all preprocessed into something
else.
Maybe that is why I could get away with unloading plugins as they
never really used the os directly. Now, I must admit that at several
occasions it seemed as if the latest version is not being used as
I replaced the older.
Four or five years ago, I was at one of my clients, I was making
changes in the code on my MacBook and moving resulting plugin
over the network directly to his computer where it was being
used, but at some point we realized that the same old version
is executed. The client restarted the application on his Mac and
then the latest version kicked in.
I was on Leopard, he was on Tiger so we thought maybe the Tiger
was the problem.
Anyway, thanks for your remarks.
Igor
--- On Wed, 6/19/13, Chris Hanson wrote:
> From: Chris Hanson
> Subject: Re: Carbon app and Cocoa/Carbon Bundle plugin - possible?!
> To: "Igor Delovski"
> Cc: "Jon Gotow" , "email@hidden"
> Date: Wednesday, June 19, 2013, 3:10 AM
> On Jun 18, 2013, at 12:51 PM, Igor
> Delovski
> wrote:
>
> > At first glance this seems to be the case. Just put
> into comments this part: CFRelease (bundleRef); and
> application stopped crashing. Now I have to reorganize
> everything, plugins need to tell the application if they
> need to stay alive forever.
>
> You can’t really safely unload any of your plug-ins, even
> if they don’t use Cocoa directly, because subsystems they
> rely upon (for example, other OS-level frameworks) may use
> Cocoa.
>
> Virtually all developers should treat
> CFBundleUnloadExecutable, -[NSBundle unload], and dlclose(3)
> as if they’re unavailable.
>
> -- Chris
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden