MathGroup Archive 1999

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

Search the Archive

MathLink and STL

  • To: mathgroup at smc.vnet.net
  • Subject: [mg17430] MathLink and STL
  • From: Dr Dan <drdanw at my-dejanews.com>
  • Date: Thu, 6 May 1999 02:44:32 -0400
  • Organization: Deja News - The Leader in Internet Discussion
  • Sender: owner-wri-mathgroup at wolfram.com

Has anyone come across an object oriented interface to the MathLink library? 
A wrapper creating an STL container out of MathLink would be particularly
useful.

Consider, instead of

int sz = 30;
double* a[30];
MLGetRealList(stdlink, &ddata, &sz);
for(int i = 0; i < sz; i++) a[i]=ddata[i];
MLDisownRealList(stdlink, ddata, sz);

we could have

MathLink ml;
int sz = 30;
vector<double> a(sz);
copy(a.begin(), a.end(), ml);

or, instead of

MLPutFunction(stdlink, "EvaluatePacket", 1);
MLPutFunction(stdlink, "Plus", 2);
MLPutInteger(stdlink, 1);
MLPutInteger(stdlink, 2);
MLEndPacket(stdlink);

we have

ml << Function("Plus", 2) << 1 << 2 << endpkt;

Could be an interesting project...

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


  • Prev by Date: Mathematica tracing.
  • Next by Date: Re: HELP: specifying range for a variable?
  • Previous by thread: Re: Mathematica tracing.
  • Next by thread: Where I can find new Notebook.sty file?