This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
MathLink C Function


int MLPutInteger32(MLINK link, int i)
puts the 32-bit integer i to the MathLink connection specified by link.
  • MLPutInteger32() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLPutInteger32() fails.
  • You can send arbitrary-precision integers to Mathematica by giving lists of digits, then converting them to numbers using FromDigits.
  • MLPutInteger32() is declared in the MathLink header file mathlink.h.
#include "mathlink.h"

/* send the expression Times[10,30] to a link */

void f(MLINK lp)
    if(! MLPutFunction(lp, "Times", 2))
        { /* unable to send the function to lp */ }

    if(! MLPutInteger32(lp, 10))
        { /* unable to send the integer to lp */ }

    if(! MLPutInteger32(lp, 30))
        { /* unable to send the integer to lp */ }

    if(! MLEndPacket(lp))
        { /* unable to send the end-of-packet sequence to lp */ }

    if(! MLFlush(lp))
        { /* unable flush any buffered outgoing data in lp */ }