Message Boards Message Boards

0
|
6526 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Change stdlink to other WSLINK when using WSPut @ WSTP

Posted 6 years ago

Is it possible to create some other WSLINK instead of stdlink with WSMain function?

The following WSTP code I tested with mathematic 10.0 and it didn't work:

std::cout<<"this is a test message."<<std::endl;
WSPutString(stdlink, "test a reply message");

The error output from Mathematica is: LinkObject::linkd: Unable to communicate with closed link LinkObject[......]

However if I removed the std::cout line, it works fine. I can get the reply message on Mathematica.

I guess it is because they're all using stdlink, so I would like to change to another WSLINK. Is it possible to change it?

POSTED BY: chad andy

Are you creating an installable MathLink program?

If yes, and if you followed the structure shown for the main/WinMain functions in the examples (e.g. addtwo.c) precisely, then this error likely indicates that your program is crashing. It's hard to tell why without a complete example.

What I can say with certainty though is that using the name stdlink has absolutely nothing to do with this, and there is no relationship between iostreams (std::cout) and MathLink/WSTP.

POSTED BY: Szabolcs Horvát
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract