Third party dependencies in a delphi expert
i am writting a delphi ide expert, with some third party dependencies (visual controls), my question is when this expert will be installed in a target machine , this pc will be requires have installed these third par开发者_运维百科ty components too? or the componentes are embeded inside of the bpl generated?
They will be dependent on any packages you place in your package's requires clause. Then any packages they require, and so on...
They can be embedded if you place the units you depend on into your package.
Example:
package Package1;
...
// Items in the section mean that your package
// will depend on the BPL of the other package
// Target machine must have the BPL's listed here.
requires
rtl;
// Unit's here mean that the code is in your
// package and not in another BPL
contains
Unit8 in 'Unit8.pas';
end.
Word's of Caution
- Two packages loaded that contain unit's with the same name.
- Licensing of 3rd Party Components, as commercial libraries can not typically be repackaged as a library.
- Developers may also want to use a different version of the 3rd party component. You will need to provide source to these developers so they can relink your expert.
One Way to avoid problems
- Rename 3rd Party units that are used.
- Include renamed units in your package.
I have seen this method done many times.
For example Castalia does this, and recommends this method when using it's open source delphi lexer and parser.
About BPL experts:
If you can avoid linking to the design-time versions of the 3rd party controls, stick to runtime BPL's only, you can legally ship those with your expert as your expert.
Unfortunately I can't say you can safely ship them because you're dealing with other Delphi developers: they might have the same 3rd party packages but in a different version! With a normal application you can simply install your version of BPL's to your application's directory, but this is not going to work for a Delphi IDE because the the application is the IDE: the IDE is the one loading and linking the BPL's, and it can't load two versions of the same BPL. And you can't replace your user's version because they need to keep the version they licensed, not even if your version is newer!
The solution: DLL experts:
One possible solution is to compile your expert as a DLL, not as a package, and statically link all dependencies. That way you're no longer dependent on your user's version of the 3rd party controls.
As Robert Love was saying: the dependencies exists,
Any delphi project can be set to compile with or without packages. Project | Options | Packages | check or uncheck the "Build with runtime packages".
When you build/compile with packages, that means you are not embedding the code from the packages and you will have to distribute the bpl's that your expert depends on. As Robert was also saying: please pay attention to the licenses with regard to redistribution when you choose this option.
When you build/compile without packages, the code from the third party controls/libraries is embedded in your executable/dll and that's all you have to distribute.
精彩评论