Re: Strategy for using common classes in multiple Cocoa plug-ins?
Re: Strategy for using common classes in multiple Cocoa plug-ins?
- Subject: Re: Strategy for using common classes in multiple Cocoa plug-ins?
- From: Darrin Cardani <email@hidden>
- Date: Sat, 21 May 2005 16:52:53 -0500
At 11:05 AM -0700 5/21/05, "Mark Munz (DevList)"
<email@hidden> wrote:
In an earlier discussion, it was pointed out that Cocoa classes all
share the same namespace per process. The problem I'm realizing is
that I have some common utility classes that I'm using that are used
in several plug-ins (and will be sharing the same space).
I'm wondering what the best strategy for dealing with this issue is
in writing these plug-ins?
I'm not sure what the best strategy is, but here's what I've done in
the past. I have several iMovie plugins that share Cocoa code. For
example I wrote a Warp effect and a Morph transition. Both shared the
following Objective-C classes: Mesh, GWorldView, and GridView. So
what I did was in the prefix headers of the 2 projects, I used the C
pre-processor to solve the problem like so:
// Morph Prefix.h
#define Mesh SlickMorphMesh
#define GWorldView SlickMorphGWorldView
#define GridView SlickMorphGridView
and in the Warp plugin, like so:
// Warp Prefix.h
#define Mesh SlickWarpMesh
#define GWorldView SlickWarpGWorldView
#define GridView SlickWarpGridView
This way, they actually compile to different names depending on
what's defined in the prefix file.
Like I say, I don't know if that's the best way to handle it, but it
solves the problem. It also solves the problem of using a newer
version of one of the plugins and an older version of the other. That
way if the common code had been updated between when the older plugin
was written and when the newer plugin was written, you don't have to
worry about which version got loaded because they actually have
different names. On the other hand, it also means that if they were
built with the same version, you end up with 2 copies of the same
code.
Darrin
--
Darrin Cardani - email@hidden
President, Buena Software, Inc.
<http://www.buena.com/>
Video, Image and Audio Processing Development
_______________________________________________
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