gets a WSTP connection to use for evaluations in Mathematica.


  • Used in C/C++ code in a library function called from Mathematica.
  • The link returned by getWSTP() is a loopback link.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

The following gets a WSTP connection and uses it to send a message to the kernel:

    WSLINK link = libData->getWSTP(libData);
    WSPutFunction( link, "EvaluatePacket", 1);
    WSPutFunction( link, "Message", 2);
    WSPutFunction( link, "MessageName", 2);
    WSPutSymbol( link, "MyFunction");
    WSPutString( link, "info");
    WSPutString( link, "Message called from within DLL function.");
    libData->processWSTP( link);
    pkt = WSNextPacket( link);
    if ( pkt == RETURNPKT) {
Translate this page: