LIBRARYLINK SYMBOL

processWSTP


calls Mathematica to process the expression written onto a link.

DetailsDetails

  • Used in C/C++ code in a library function called from Mathematica.
  • Typically, the expression written on the link will contain EvaluatePacket; the result will be a ReturnPacket.
  • A zero error code value will be returned if there is an error.

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:

    int success;
    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.");
    success = libData->processWSTP( link);
    if (!success) return success;
    pkt = WSNextPacket( link);
    if ( pkt == RETURNPKT) {
        WSNewPacket(link);
    }