What is the difference between MathLink and WSTP programs? Will the use of MathLink protocol be maintained or not?
1 Answers
There is no difference. "WSTP" is just a new name for MathLink.
As part of the renaming they also changed the function names from ML-prefixed ones to WS-prefixed ones. Now Mathematica comes with two developer kits, found in SystemFiles/Links/MathLink and SystemFiles/Links/WSTP. There is no functional difference between these two. The only difference is in the naming.
Note that at the same time when the renaming happened, a new version of MathLink/WSTP was introduced (interface version 4). Interface version 4 does introduce several new things, but it's important to understand that this is completely independent from the renaming. You'll still get the new things if you use the ML-prefixed devkit.
Personally I stick to the ML prefixed version so my code can more easily be ported to be compilable with the devkit that ships with v9.
Update (2017 August, M11.1):
Which one should you choose for a new project, MathLink or WSTP? The documentation states that MathLink is deprecated in favour of WSTP (e.g. here).
Despite this, I recommend people choose MathLink, i.e. use the ML-prefixed functions. The reasons are the following:
- I am not aware of any contexts where using the
WS-prefixed functions has a practical advantage (as of M11.1), but there are several cases of the reverse. - LibraryLink still seems to use
ML-prefixed variants, and won't work out-of-the-box with theWS-prefixed ones (at least not without any extra work—I never tried to get theWS-prefixed ones working) - The CCompilerDriver packages always links to MathLink (not to WSTP). This package is useful both for compiling LibraryLink libraries and for compiling installable MathLink programs. It's especially useful for creating a cross-platform compilation setup.
- The Raspberry Pi version of Mathematica still includes only the
ML-prefixed libraries, but not theWS-prefixed ones (verified in M11.0.1, the latest as of 2017 August). Your code won't compile on this platform unless you use MathLink instead of WSTP. - Opening the Mathematica executables (either kernel or front end) with a hex editor reveals that internally they use
ML-prefixed names (as of M11.1). This gives me some assurance that MathLink isn't likely to go away in the near future.
Needless to say, this is a personal opinion, and it is directly at odds with what Wolfram says. Follow it at your own risk. I am posting it here because it agrees with what Wolfram does.
- 234,956
- 30
- 623
- 1,263
First, you are right about the interface 4 release and the renaming (or, as we refer to it internally, a rebranding). And yes, there was some messiness that happened at the seams. I'm sorry about that.
FWIW WSTP/MathLink have moved into my wheel house now. So, feel free to pester me/call me out about the state of WSTP development. In the next comment, I'll discuss briefly what's happened in 11.2 and where things are going.
– John Fultz Aug 29 '17 at 15:24