# Where does the LibraryLink version information come from?

LibraryVersionInformation returns the following information:

Needs["LibraryLink"]
lib = FindLibrary["demo"];
LibraryVersionInformation[lib]

<|"Name" -> ...,
"Path" -> ...,
"MajorVersion" -> 0, "MinorVersion" -> 0, "RevisionNumber" -> 0,
"WolframLibraryVersion" -> 3|>


Where does all this version information come from?

I assume that WolframLibraryVersion comes from

DLLEXPORT mint WolframLibrary_getVersion( ) { return WolframLibraryVersion; }


What about MajorVersion, MinorVersion and RevisionNumber? How can I set this information for my own libraries?

This is going to depend a lot on the operating system.

On Linux (source),

Every shared library also has a real name'', which is the filename containing the actual library code. The real name adds to the soname a period, a minor number, another period, and the release number. The last period and release number are optional.

for example, libfoo.so might be a symbolic link to libfoo.so.1.2.3 and then the major version, minor version and release number are 1, 2 and 3.

The details of library versioning on other operating systems are being left as an exercise for the reader, but here is a brief sketch:

On OS X, the version information is stored in the Mach-O header. LibraryVersionInformation will either get it from an otool call (if otool is present) or read it directly from the header. Setting the version of a .dylib is done through a linker option, -current_version (source).

On Windows, the version information is stored in the PE/COFF header. Visual Studio, for example, has the /VERSION linker option (source) to set it. LibraryLink reads the information through a DllGetVersion or GetFileVersionInfo` API call.

• Ah, so it's not LibraryLink-specific at all! – Szabolcs Aug 13 '15 at 16:07