LIBRARY LINK SYMBOL

processMathLink


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 MathLink connection and uses it to send a message to the kernel:

    int success;
    MLINK link = libData->getMathLink(libData);
    MLPutFunction( link, "EvaluatePacket", 1);
    MLPutFunction( link, "Message", 2);
    MLPutFunction( link, "MessageName", 2);
    MLPutSymbol( link, "MyFunction");
    MLPutString( link, "info");
    MLPutString( link, "Message called from within DLL function.");
    success = libData->processMathLink( link);
    if (!success) return success;
    pkt = MLNextPacket( link);
    if ( pkt == RETURNPKT) {
        MLNewPacket(link);
    }
New to Mathematica? Find your learning path »
Have a question? Ask support »