24

A LibraryLink library compiled with headers having a certain WolframLibraryVersion will not work with Mathematica versions that support only earlier WolframLibraryVersions.

For example, a library compiled with M12.0 (WolframLibraryVersion == 5) will work not only in 12.0 but also in 12.1–13.0 (WolframLibraryVersion == 6). However, it will not work in 11.3 (WolframLibraryVersion == 4).

Which Mathematica versions use which WolframLibraryVersion?

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263

2 Answers2

24

Run the following to find out the WolframLibraryVersion for your Mathematica, and please help complete the table below, if any entries are missing.

StringCases[
 Import[FileNameJoin[{$InstallationDirectory, "SystemFiles", "IncludeFiles", "C", "WolframLibrary.h"}], "String"],
 StartOfLine ~~ ___ ~~ "WolframLibraryVersion" ~~ 
   Whitespace .. ~~ (v : DigitCharacter ..) ~~ Whitespace ... ~~ 
   EndOfLine :> v
]

Mathematica WolframLibraryVersion
13.1 – 14.0 7
12.1 – 13.0 6
12.0 5
11.2 – 11.3 4
10.0 – 11.1 3
9.0 2
8.0 1

Notes

  • LibraryLink was not available before 8.0.
Ben Izd
  • 9,229
  • 1
  • 14
  • 45
Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
5

When you come to version 13.1:

Needs["CCompilerDriver`"]
dll = CCompilerDriver`CreateLibrary["
#include <WolframLibrary.h>

EXTERN_C DLLEXPORT mint get_WolframLibraryVersion() { return WolframLibraryVersion; } ", "dllfile", "Language" -> "C++"];

dec=LibraryFunctionDeclaration[fun->"get_WolframLibraryVersion",dll,{}->"MachineInteger"]; WolframLibraryVersion = FunctionCompile[dec, Function[{}, fun[]]]

Then we can get the library version:

WolframLibraryVersion[]

7

yode
  • 26,686
  • 4
  • 62
  • 167