30
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ Is there a way to find out what's new / different in each version? $\endgroup$ Commented Aug 19 at 13:37
  • $\begingroup$ @GregHurst First step is to look in the headers, and compare with earlier versions. Then see if the changes are documented. $\endgroup$ Commented Aug 22 at 19:30

2 Answers 2

31
$\begingroup$

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
14.2 - 14.3 8
13.1 – 14.1 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.
$\endgroup$
2
  • 1
    $\begingroup$ This table is now complete, but feel free to update once 13.1 comes out. $\endgroup$ Commented May 24, 2022 at 13:01
  • $\begingroup$ Interesting. Maybe the change between 14.1 and 14.2 is the reason for the performance degradation observed in this post? $\endgroup$ Commented Aug 15 at 17:02
7
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.