getWSTP

gets a WSTP connection to use for evaluations in Mathematica.

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

    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) {
            WSNewPacket(link);
        }

    Tutorials