There is a bug in the Wolfram Symbolic Transfer Protocol Development in C (Windows).

I described it in the next answer by myself, from which I summarize:

One cannot successfully compile the addtwo.c demo in C:\Program Files\Wolfram Research\Mathematica\10.0\SystemFiles\Links\WSTP\DeveloperKit\Windows\WSTPExamples\addtwo, even if one follows the instructions in "WSTP Development in C (Windows)" strictly.

Question: Does anybody have a patch?

Well, I have one and I can post it here as an answer if somebody gives me a hint on how to do it.

BTW, is anybody interested in Mathematica related programming with DELPHI, I have done a bit of code porting, any suggestions on pascal style porting are welcomed.

  • 2
    $\begingroup$ I suppose you could post it to a place like GitHub and provide a link. Your description is pretty vague and hardly seems like a question for other users to answer. (This is a Q&A site.) $\endgroup$ – Michael E2 Dec 11 '14 at 0:10
  • 1
    $\begingroup$ @MichaelE2 But he can answer himself! $\endgroup$ – Dr. belisarius Dec 11 '14 at 0:11
  • $\begingroup$ @belisarius The only (explicit) question is how to post an attachment. $\endgroup$ – Michael E2 Dec 11 '14 at 0:14
  • $\begingroup$ @MichaelE2 Yeah, yeah, there :). I'll edit the question $\endgroup$ – Dr. belisarius Dec 11 '14 at 0:38
  • 1
    $\begingroup$ I added what I thought was the crux of the question. I think it is good to have a description of the problem in the question, so that users can see easily what it about. Also I tagged it "Windows" for now. If someone else knows the problem exists on other platforms and that Donald's patch fixes it, this could be changed. $\endgroup$ – Michael E2 Dec 11 '14 at 18:01

Wolfram has replaced MathLink with WSTP, but both their document and tool related to this are outofdated. Because of this bug, nobody could successfully compile the "addtwo.c" demo in "C:\Program Files\Wolfram Research\Mathematica\10.0\SystemFiles\Links\WSTP\DeveloperKit\Windows\WSTPExamples\addtwo", even if he followed the instruction in "WSTP Development in C (Windows)" strictly. The fixed document can be download from Baidu netdisk:link password: xiwn

Thanks for MichaelE2's suggestion. I should post this in Wolfram community link, but I never login the site successfully, so ...


I did compile the addtwo example using CreateExecutable as follows:

examplesDir = 
  FileNameJoin[{$InstallationDirectory, "SystemFiles", "Links", 
        "WSTP", "DeveloperKit", $SystemID, "WSTPExamples", "addtwo"}];
files = FileNames["*", examplesDir]

compilerAdditionsDir = 
 FileNameJoin[{$InstallationDirectory, "SystemFiles", "Links", "WSTP",
        "DeveloperKit", $SystemID, "CompilerAdditions", "mldev64"}]

CCompilerDriver`CCompilerDriverBase`Private`$MprepExePath = 
 FileNameJoin[{compilerAdditionsDir, "bin", "wsprep.exe"}]

exe = CreateExecutable[files, "addtwo",
  "ShellCommandFunction" -> Print,
  "SystemLibraries" -> "wstp64i4m.lib",
  "SystemIncludeDirectories" -> 
       FileNameJoin[{compilerAdditionsDir, "include"}], 
  "SystemLibraryDirectories" -> 
       FileNameJoin[{compilerAdditionsDir, "lib"}]]

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.