LibraryLink`
LibraryLink`

getWSLINK (C 函数)

gets a WSLINK connection to use for evaluations in the Wolfram Language.

更多信息

  • Used in C/C++ code in a library function called from the Wolfram Language.
  • The link returned by getWSLINK() is a loopback link.

范例

基本范例  (1)

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

    WSLINK link = libData->getWSLINK(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->processWSLINK( link);
    pkt = WSNextPacket( link);
    if ( pkt == RETURNPKT) {
        WSNewPacket(link);
    }