views:

1143

answers:

3

(More package/component install fun for me -- thanks everyone for all your help to date).

I am getting the error listed as the title, in Delphi 2007. Package A is my package of frame-based "viewer panels." Package B is a package containing a couple of components that are used to show information about datasets linked to a gven database (their SQL, state, class type, etc), one of which is a non-visual component (we'll call it the Inspector) which creates and calls a form showing that information. Unit X is the unit of that form.

I added the Inspector component to one of my viewer panels in Package, but have since deleted it, and cannot find any reference to it in View Source for the project, nor in the unit of the frame-based viewer panel I added it to. Where is the reference hiding?

Also, what would make adding that Inspector component to one of the view panel frames (which also get installed as registered components), cause this problem?

This is likely related to this previous question and this one as well, but I decided to start fresh with this specific symtpom / issue, just to keep it succinct and clear, and hopefully thus useful to someone else later. Thanks in advance for any and all help.


Update:

Thanks to Loren, I was able to find and remove the USES reference that remained and was causing the problem. HOWEVER, I'm still not clear on how to accomplish what I'm trying to accomplish. : \ Here's the latest:

The Inspector is a simple non-visual component which contains a DataSet property, and an internal "Info Form." Calling a ShowInfo method creates the form, and populates it with various information related to the linked DataSet. I'm wanting to used it to debug the SQL driving the viewers.

As mentioned above, the Inspector is contained in Package B. The viewers are in Package A. I want to use the Inspector component on some of the TFrame descendents (which register as true palette components). When I drop that component on the given TFrame however to use it, and compile/install Package A, I get the "Cannot load package A, it contains unit X, which is also contained in package B" error. It's now clearly the cause, and I can re-create the problem on demand.

moobaa's suggestion below makes sense, and yet it seems that even though I am trying to do approach #2 of what he suggest, it does not work. What am I missing? It seems like this should be doable, and in fact it seems like most packages I've seen use other installed packages all the time (included the VCL itself).

Note: Package B does not depend on Package A, as far as I can tell (and I've installed it stand alone, so that seems to agree).

(BTW, are there any tools to "chart out" package dependencies like this? I'm using D2007)

As always, thanks for your time and help.

+5  A: 

It could also be related to this question.

Unit X is clearly being linked into both packages. There's a couple of ways around this:

  • create a new package (we'll call it Package C) with Unit X (and any other dependencies), then change Package A and Package B to both use Package C; or...
  • include Unit X in Package B, and have Package A use Package B (which is a more compact form of the first solution).


If the viewers are explicitly mentioned in your Package B code, then Package B most certainly should be using Package A (ie, there should be an explicit dependency there). If that indication of shared code isn't explicitly made, B will compile it's own version of the code into B, leading to the problem you're seeing.

Now, if that dependency is OK, adding a reference to Package A from Package B should clear this problem up right away; after all, B will be "using" the code in Package A, and the same units won't be getting compiled into two packages. However, if this introduces circular references (I can't remember whether A uses B or not), then you might have a bit of refactoring to to :}

moobaa
Thanks. I'm not finding out how/where Unit X is getting linked into A at this point (post-seemingly-removing the Inspector component reference). Any suggestions how to ferret that out? Thanks again.
Jamo
moobaa
moobaa -- thanks for that. I've updated the question w/more specific cause/effect symptoms, and would greatly appreciate any additional thoughts/insights you might have. Thanks so mcuh for your suggestions thus far!
Jamo
+2  A: 

Just because you deleted the component doesn't mean you deleted the module name from the USES clause--those aren't auto-deleted.

Loren Pechtel
A: 

Loren:Requires clause, since it is a .dpk, you can't USES a packages afaik.

I'd simply clean up the $(BDSDIR)/projects/ dir, my own projects dir to remove B.dcp and all dcu's for the units that were in B and then rebuild A.

Another thing to check if there is a component registered that depends on B.

Marco van de Voort
There is a component that depends on B -- the Inspector itself. BUT I'm not seeing any direct reference (uses in units, or requires in project file) to B in A at this point. Is there somewhere else to check? I'll try the dcp advice.
Jamo
What I meant was a unit is being pulled in by a Uses that is bringing in something he doesn't want.
Loren Pechtel