7
$\begingroup$

Bug introduced in 11.2 and persisting through 11.3


I maintain a C++ library with a WSTP interface to Mathematica. Some of my users have noticed that in Mathematica versions 11.2 and 11.3, they see a compilation error that WSEvaluateString isn't defined. Some compilers hint that it might be a typo for MLEvaluateString. This puzzled me, as I thought that MLEvaluateString was deprecated, as it had been replaced by WSEvaluateString during the MathLink to WSTP rebrand. This is also mentioned in the docs.

So I checked the wstp.h header file for a few recent versions of Mathematica. I don't have access to them all, let alone a change log! I noticed that in Mathematica 11.1, wstp.h indeed defines WSEvaluateString. But in Mathematica 11.3, it contains only MLEvaluateString.

There's also a new _REBRAND_H_ block in the 11.3 wstp.h header file, that uses macros to make aliases between WS and ML function names. But there isn't one for WSEvaluateString.


Wolfram technical support confirmed that it was a bug affecting 11.2 onwards. Are there any ways to circumvent build problems in C callers using e.g., preprocessor macros?

$\endgroup$
  • $\begingroup$ How much of wstp.h am I allowed to quote in my question? $\endgroup$ – innisfree Apr 19 '18 at 0:27
  • 1
    $\begingroup$ I can confirm the difference you're seeing between 11.1 and 11.3. I think you should report this to tech support as well. $\endgroup$ – Jason B. Apr 19 '18 at 1:27
  • $\begingroup$ OK, I have reported it directly to Mathematica support. $\endgroup$ – innisfree Apr 19 '18 at 1:43
3
$\begingroup$

I noticed that the wstp.h header file uses a macro to indicate the Mathematica version. I had hoped to use it to write a work-around for this bug. However, there were two problems.

  1. The version number defined by the macro doesn't correspond to the actual Mathematica version. Perhaps this is a another bug. E.g., my Mathematica 11.1 wstp.h contains #define WSMATHVERSION 10.0.0.
  2. The format of the version number makes it difficult to use. See e.g., this question.

The 11.2 and 11.3 wstp.h header files define aliases to WS function names in a block surrounded by a header guard (perhaps this was once a separate header file). The name of the header guard is _REBRAND_H_. Thus I use that macro to judge whether the wstp.h is an 11.2 or 11.3 one affected by the bug,

#ifdef _REBRAND_H_   
#define EVALSTRING MLEvaluateString
#else
#define EVALSTRING WSEvaluateString
#endif

This should work for now, but probably won't work when this bug is addressed in the future (presumably in 11.4).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.