Like many Delphi developers, I suppose, my company has a set of internal components which use components created by third-party vendors. Whenever we change compiler versions we have to open this package, update the required package references, and recompile it. Via the newsgroups, here’s a helpful tip from Ray Konopka for Delphi component writers which works around this problem. Very few people actually seem to do this, and I myself was unaware of the feature, so I’d like to do my part in getting the information out to other developers.
In early versions of Delphi, you pretty much had to put the VCL version number into the name of the package. This was because if you were going to support multiple versions of the VCL then you needed to create separate BPL files for each version of the VCL.
Starting with Delphi 6, you can use a single DPK file without reference to the VCL number and then use the {$LIBSUFFIX } directive to have the output BPL file include the appropriate VCL version. The other nice benefit of this is that the DCP file for the package does NOT include the VCL version. Therefore, any packages that require your package, do NOT need to be edited when recompiled for a new version of Delphi.
For example, for our Raize Components product, the following files are used:
Package Source Files
- RaizeComponentsVcl.dpk
- RaizeComponentsVclDb.dpk
Package DCP files: One set created for each version of VCL
- LibDelphi7RaizeComponentsVcl.dcp
- LibDelphi7RaizeComponentsVclDb.dcp
- LibBDS2006RaizeComponentsVcl.dcp
- LibBDS2006RaizeComponentsVclDb.dcp
- . . .
Package output files:
- RaizeComponentsVcl70.bpl
- RaizeComponentsVclDb70.bpl
- RaizeComponentsVcl100.bpl
- RaizeComponentsVclDb100.bpl
- . . .
Ray
{ 3 } Comments
I second that. The packages of the JCL (http://jcl.sf.net/) and the JVCL (http://jvcl.sf.net/) use the same mecanism to make differences between versions of Delphi/C++Builder/BDS.
Ya, but unless you want all your DCUs built into the same folder regardless of version (oh, and doesn’t the IDE love mixed version dcus!), you still need seperate dpk files with different output paths, yes?
Xepol,
No, you don’t need separate DPK files for that. The Unit output directory isn’t stored in the DPK.
-Craig
Post a Comment