DLL version info on WIndows

Ingo Klöcker kloecker at kde.org
Mon Nov 3 20:30:48 UTC 2014


On Monday 03 November 2014 16:41:08 Nicolás Alvarez wrote:
> Windows has a way for executables and shared libraries (DLLs) to
> contain version information in a machine-readable format. This
> information can be seen in Explorer in the file properties
> (http://goo.gl/UbJGte) and also in the tooltip when hovering the file.
> It's also used by Windows Installer to avoid overwriting an existing
> DLL with an older version.
> 
> Qt libraries contain appropriate VERSIONINFO resources for this
> (although plugins don't; I'll submit a bug report soon). Nothing in
> KDE has this version information though.
> 
> Version information is stored in a VERSIONINFO "resource". The format
> is described here:
> http://msdn.microsoft.com/en-us/library/windows/desktop/aa381058.aspx
> 
> Apart from the version number, this resource contains information like
> the "product name", "file description", "company name", and
> "copyright". While optional, if we're going to add a version resource,
> we might as well fill these in properly; why not? :)

Agreed. :-)


> Example of a version.rc file for kcoreaddons:
> 
> VS_VERSION_INFO VERSIONINFO
>     FILEVERSION 5,4,0,0
>     PRODUCTVERSION 5,4,0,0
>     FILEFLAGSMASK 0x3fL
>     FILEFLAGS 0x0L
>     FILEOS VOS__WINDOWS32
>     FILETYPE VFT_DLL
>     FILESUBTYPE 0x0L
>     BEGIN
>         BLOCK "StringFileInfo"
>         BEGIN
>             BLOCK "040904b0"
>             BEGIN
>                 VALUE "FileVersion", "5.4.0\0"
>                 VALUE "ProductVersion", "5.4.0\0"
> 
>                 VALUE "CompanyName", "KDE Community\0"
>                 VALUE "LegalCopyright", "Copyright (c) 2014 KDE Community\0"

This copyright statement isn't a good idea. There is no legal entity called 
"KDE Community" that could enforce the copyright. The copyright of the 
different files kcoreaddons consists of is held by the authors of the respective 
files. A copyright statement for the whole DLL only makes sense if the 
copyright for all files is held by the same group of real or legal persons. In 
our case there is no group of persons holding the copyright for all files. 
Therefore, I would leave out this field.

If you still want to add it then please at least leave out the "(c)". Only the 
official copyright symbol is legally recognized as abbreviation of the word 
"Copyright". The copyright symbol is meant to be used in place of the word 
"Copyright" and not in addition to it. Even if "(c)" was a recognized 
abbreviation of the word "Copyright" (which it is not) it wouldn't make any 
sense to use both in the same statement. It's like saying "KDE desktop 
environment".


> 3. Put a template in ECM with placeholders in every value, and a macro to
> fill it in. This way there won't be a .rc file in each framework, but every
> framework will need CMake code like this:
> 
> include(ECMCreateVersionResource)
> ecm_create_version_resource(version.rc
>     PRODUCT_NAME KCoreAddons
>     FILE_DESCRIPTION "Addons to QtCore"
>     COMPANY_NAME "KDE Community"
>     COPYRIGHT "Copyright (c) 2014 KDE Community"
>     ORIG_FILENAME "KF5CoreAddons.dll"
> )
> 
> plus adding version.rc to the list of sources.
> 
> I lean towards #3 (I couldn't find a way to get the ORIG_FILENAME
> automatically; suggestions welcome)

Yes, I think this makes the most sense and is the most convenient solution. 
Maintaining the version numbers in such .rc files manually is a PITA and is 
usually forgotten. Automation is the only working solution.


Regards,
Ingo



More information about the Kde-buildsystem mailing list