Re: plugin theory
Re: plugin theory
- Subject: Re: plugin theory
- From: Ondra Cada <email@hidden>
- Date: Sun, 9 Apr 2006 20:58:26 +0200
Ryan,
On 9.4.2006, at 19:58, Ryan Glover wrote:
When a plugin is loaded, does that mean its class has been
instantiated? Another way to put it would be, do I need to load
the plugin for each instance of the plugin class I want in my main
application?
Best way would be to recall classes are objects, too (in other words,
there are two kinds of objects--classes and instances).
Loading a plug-in creates the class object (more or less the same way
as loading the application itself makes all the "normal" class
objects). The alloc method, subsequently sent to the class objects,
creates the instance. Both the operations are quite independent, the
only link between them being you need to have the class first so that
you can send it messages.
To sum it up:
- you load each plugin exactly once (or at most once, if you decide
not to load some :))
- you get the class(es) created by loading (for you probably the best
way would be the principalClass message)
- from the moment on, you use the class *exactly* the same way as you
ose other ones, namely, sending it as many alloc/init or factory
methods as you like, creating thus as many instances as you want to.
Note: using plugins, be careful where you load your resources (incl.
NIBs) from. It is kind of easy to load from a bad bundle by mistake,
with the result of getting none or wrong resource.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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