What is the best way to solve being unable to load a package because it contains a unit already in another package? The simple answer is to put those units in a third package both use, but I'm not certain that's possible in my case.

What is the best way to solve being unable to load a package because it contains a unit already in another package?  The simple answer is to put those units in a third package both use, but I'm not certain that's possible in my case.

The units are Spring4D Collections, and and are implicitly imported into the BPLs because they're used internally by some units in each BPL.  ("[dcc32 Warning] Foo.dpk(57): W1033 Unit 'Spring.Collections' implicitly imported into package 'Foo'", plus several other S4D units too.)  The problem is, I want to load several packages and I want to use the S4D code in all of them, so all of them end up having the units implicitly imported.  Because a unit can only be in one package, only one of these packages can be loaded at a time.  Even if I make one package a DLL (a possibility), there are still going to be other packages in future, plus potential third-party packages.

I have thought of building S4D's collections into a third package used by the others, though I'm not sure if the license allows it.  The final twist?  I'm trying to load all packages dynamically, and want to be able to update packages independently - they expose interfaces, so a new version will be backwards compatible to the old, but shouldn't have any non-dynamic links. Even if I built a S4D package used by the other two I'm not sure how I could use the collections inside without linking normally via 'requires', which might break if I update the S4D package for one but don't rebuild the other that also uses it.

Maybe moving them all to DLLs is the solution, but I want them to share the Application and other VCL/RTL stuff.

So I'm a bit stuck.  Any suggestions?

Comments

  1. Thanks guys. Stefan Glienke, I'm not sure how I have it installed - I may reinstall it to get the package and use that. Thanks :)

    ReplyDelete
  2. David Millington If you have used the recommended way (using Build.exe) it has compiled the packages and created the bpl and dcp along with the dcu files.

    ReplyDelete
  3. Stefan Glienke I think at the time (a few weeks ago) there was no XE6 support in Build so I installed it manually. I'll reinstall it.

    ReplyDelete

Post a Comment