How to force a package to reference another package

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to force a package to reference another package

Bob Jarvis
I've got a package which only contains some loose methods (adds new
Win32 function calls to KernelLibrary) and I want to force packages
which use this new method to have a reference to my package so it will
be loaded when needed.  Is there a way to do this other than by adding
a "dummy" class and adding references to this "dummy" class where
needed?  This latter method is workable but seems to be a bit of a
kludge.  I'm hoping for something more robust and automatic, and less
error-prone.
--
Bob Jarvis
Compuware @ Timken



Sent via Deja.com http://www.deja.com/
Before you buy.


Reply | Threaded
Open this post in threaded view
|

Re: How to force a package to reference another package

Ian Bartholomew-2
Bob,

"Bob Jarvis" <[hidden email]> wrote in message
news:908dm2$7rc$[hidden email]...
> I've got a package which only contains some loose methods (adds new
> Win32 function calls to KernelLibrary) and I want to force packages
> which use this new method to have a reference to my package so it will
> be loaded when needed.  Is there a way to do this other than by adding
> a "dummy" class and adding references to this "dummy" class where
> needed?  This latter method is workable but seems to be a bit of a
> kludge.  I'm hoping for something more robust and automatic, and less
> error-prone.

You can achieve the same effect by creating a global and adding it to your
loose methods package. Any other package that contains a reference to the
global (just the name of the global added to the source of one method within
the package will do) will then have the loose methods package as a
prerequisite.

It's the same effect as adding a class but, IMHO, a bit tidier and easier to
use.

Another technique I've use is to store all the loose methods in a normal
workspace/script file and load the file as part of the preinstall script of
any package that needs it. The downside is that you do need to be able to
guarantee the location of the file, or be able to calculate it
dynamically...

Ian