MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: MathLink: support for long longs?

  • To: mathgroup at
  • Subject: [mg44109] Re: [mg43889] MathLink: support for long longs?
  • From: Dale <dale at>
  • Date: Thu, 23 Oct 2003 07:14:55 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

At 02:05 AM 10/10/2003, Sascha Kratky wrote:
>Many C compilers have a type "long long" for doing 64bit integer
>arithmetic. Does MathLink support sending and receiving of "long long"

Not as a native type, but MathLink does have text interface which allows 
you to transfer generic data as strings. Here's an example adapted from 
FastBinaryFiles (

Putting data to Mathematica:

long long temp;
long numchars;
char buf[64];

sprintf(buf, "%lld", temp);
numchars = (long)strlen(buf);
MLPutNext(stdlink, MLTKINT);
MLPutSize(stdlink, numchars);
MLPutData(stdlink, buf, numchars);

Getting data from Mathematica:

long long temp;
long num_bytes;
int type;
char buf[64];

type = MLGetNext(stdlink);
MLBytesToGet(stdlink, &num_bytes);
MLGetData(stdlink, buf, num_bytes, &num_bytes);
buf[num_bytes] = '\0';
sscanf(buf, "%lld", &temp);

Omega Consulting
"The final answer to your Mathematica needs"

  • Prev by Date: Re: two's complement function
  • Next by Date: Re: InterpolatingFunctionAnatomy
  • Previous by thread: MathLink: support for long longs?
  • Next by thread: Partial dérivates