Jump to content
pyscripter

Delphi 10.4.1 LIBSUFFIX AUTO

Recommended Posts

LIBSUFFIX AUTO has been a much requested feature for ages.  The Delphi 10.4.1 announcement said:

 

Quote

Package AUTO libsuffix: packages can now have an automatic version suffix, instead of manually updating and specifying the right version suffix with each new release. (The compiler quietly supported this in 10.4, but full support for the feature in the IDE and package project settings is introduced in 10.4.1.)

Sounded interesting so I decided to try that.  I first searched the documentation and found the following:

Quote

Note: In RAD Studio Sydney 10.4, the $LIBSUFFIX directive allows the use of an AUTO option. This option makes the compiler use the current release number for packages, it also allows to upgrade a package to a new release, with no need to update the libsuffix value.

 

So I added {$LIBSUFFIX AUTO} to a package of mine say xyz.dpk  and the bpl file generated was indeed xyz270.bpl.   However I got an error message saying:

 

Quote

[Fatal Error] Can't load package xyzAUTO.bpl.
The system cannot find the file specified 

This much for "full support" for this feature.  :classic_angry:   Am I missing something??

  • Sad 1

Share this post


Link to post
6 hours ago, pyscripter said:

However I got an error message saying:

When did you get that message? On package install?

 

I don't have 10.4.1 installed at the moment (tested the uninstaller yesterday and haven't had time to install again) so I can't try myself.

Share this post


Link to post

Did the same test and same problem, but on Win32. On Win64 it works properly for me

Share this post


Link to post
18 hours ago, pyscripter said:

This much for "full support" for this feature.  :classic_angry:   Am I missing something??

The actual {$LIBSUFFIX AUTO} directive was added to the compiler in 10.4, but they didn't advertise its existence yet, so nobody has really played with it until now.  So, if the linkage is broken now, it was probably broken in 10.4 to begin with and nobody noticed.

 

10.4.1 just adds the ability to set the libsuffix to AUTO in the Project Options dialog.

 

I don't have 10.4 or 10.4.1 installed, so I can't test this myself.

 

I created a ticket for this:

RSP-30820: Fail to load package with LIBSUFFIX AUTO

 

Edited by Remy Lebeau

Share this post


Link to post
18 hours ago, pyscripter said:

LIBSUFFIX AUTO has been a much requested feature for ages.  The Delphi 10.4.1 announcement said:

 

Sounded interesting so I decided to try that.  I first searched the documentation and found the following:

So I added {$LIBSUFFIX AUTO} to a package of mine say xyz.dpk  and the bpl file generated was indeed xyz270.bpl.   However I got an error message saying:

 

This much for "full support" for this feature.  :classic_angry:   Am I missing something??

 

The new drop down inserts $(Auto)    Have you tried that text?

 

Share this post


Link to post
23 minutes ago, Darian Miller said:

 

The new drop down inserts $(Auto)    Have you tried that text?

 

Thanks Darian.  I did.  The problem only happens when you have a dpk file without a project file.  If the dpk file contains the new directive {$LIBSUFFIX AUTO} the IDE does not recognize that and thinks the actual suffix is "AUTO".

Edited by pyscripter

Share this post


Link to post
11 minutes ago, pyscripter said:

Thanks Darian.  I did.  The problem happens when you have a dpk file without a project file.  If the dpk file contains the new directive {$LIBSUFFIX AUTO} the IDE does not recognize that and thinks the actual suffix is "AUTO".

Ah, ok.  I didn't try that yet.

 

Share this post


Link to post

$(Auto) is a new environment variable, introduced in Delphi 10.4. Embarcadero didn’t make a big show around it so it went unnoticed by most programmers. But don’t ignore it! It is extremely useful for packages, where it can be used as an automatic version suffix in the package’s name.

How does it work?

$(Auto) will be automatically substituted by Delphi with compiler’s version number:

  • “270” for Delphi 10.4
  • “280” for Delphi 11
  • Etc.

When used in the Lib Suffix field, Delphi will automatically add the compiler version number at the end of the BPL name.

 

For example, if my Light Saber package is named LightSaber.DPK, without this automatic suffix, the binary files will be called LightSaber.BPL (and DCP). The name will be static no matter where I compile the library (Delphi Sydney or Alex). So, if I have two Delphi versions installed in parallel, the resulted BPLs will have the same name and we would not know which is for which Delphi version.

 

But with the auto suffix the output file will be called LightSaber270.BPL under Delphi Sydney and LightSaber280.BPL under Delphi Alex.

Without $(Auto), we would have to manually update the right version suffix with each new Delphi release, or we would need packages with different names (LightSaber270.DPK, LightSaber280.DPK, LightSaber290.DPK, etc).

Note that when we use the LightSaber library in the requires section of another package, we specify it under its standard (non-suffixed) name. Delphi Sydney will correctly look for a file named LightSaber270.bpl and Delphi Alex for LightSaber280.bpl.

Requires

  VclSmp,

  Vclwinx,

  LightSaber;    // not LightSaber270 !

Using a library with multiple Delphi versions

There are multiple reasons for installing and using multiple Delphi versions in parallel:

  • Testing a new Delphi release to see if it is worth purchasing it.
  • Testing a new Delphi release to see if your code still compiles without issues.
  • For library developers, testing if your library compiles with all (new and old) Delphi versions where you want to deliver/sell your library.

Hint: if you purchase a license for a specific Delphi version, you have automatic access to all versions below that.

With the four environment variables described above, we can have fully automatic naming for the output files. Each DCU file will go to the correct output folder and each BPL/DCP file will be correctly suffixed.

Now we can truly have multiple Delphi versions installed and functioning in parallel.

 

Source: https://gabrielmoraru.com/auto-one-package-to-rule-them-all/

 

Edited by FreeDelphiPascal

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×