MathGroup Archive 2003

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

Search the Archive

package functions in mathlink

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43571] package functions in mathlink
  • From: theoryboy at my-deja.com (Peter Saffrey)
  • Date: Sun, 21 Sep 2003 05:42:12 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I have defined a package which I would then like to interact with via
mathlink. The relevant part of the package simply looks like this:

simpfun[x_, y_] := x - y

I open the package by using 

MLPutFunction(link, "EnterTextPacket", 1);
MLPutString(link, "<</home/pzs/workspace/mathematica/testpackage.m");
MLEndPacket(link);

and then call it using

MLPutFunction(link, "EvaluatePacket", 1);
MLPutFunction(link, "simpfun", 2);
MLPutInteger(link, 4);
MLPutInteger(link, 2);
MLEndPacket(link);

But rather than getting back an integer answer, I am returned an
expression that contains the complete function call. I feel sure I
must be using the wrong packet passing function, but EvaluatePacket
seems appropriate. What am I doing wrong?

Peter


  • Prev by Date: Re: why do recursive function calculations take so long in Mathematica?
  • Next by Date: Re: Nonlinear regression
  • Previous by thread: Evaluation semantics have changed
  • Next by thread: Re: package functions in mathlink