MathGroup Archive 2005

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

Search the Archive

simplified C API call in MathLink

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55908] simplified C API call in MathLink
  • From: Edward Peschko <esp5 at pge.com>
  • Date: Sat, 9 Apr 2005 03:56:29 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

hey all,

I was wondering if Wolfram Research had plans for a simpler API for mathlink.
What I'm envisioning is something like:

    void *ans = math_ematic("CForm[Integrate[x^2, x]]");

where you could enter 'free form' math expressions, exactly as you would 
under running Mathematica itslef, and MathLink would return back the char 
string "Power(x,3)/3" as a result.

Error handling could be done perror style, or perhaps the error could be 
passed back as a structure:

struct math_ans
{
	void *ans;
	char *err;
};

or somesuch, gained by refactoring the code that is used to produce the 'math'
executable itself, and abstracting out the I/O associated with that program 
and turning it into a function call.



I think something like this would be invaluable for integrating mathematica into
scripting languages, big and small, since C is everywhere, and every scripting 
language worth its salt has the means of embedding c programs. I've looked at 
Math::ematica (perl5), and the Python bindings for mathematica (python), and they
both suffer from needing to mirror the C-API which is optimized for speed 
rather than for flexibility. 

Making a generic, 'meta-method' for passing any expression to the math kernel and 
getting a response back seems to me to be a vast timesaver. You could optimize for
flexibility first, and then when the need for optimization arises, you could convert
from the slower metamethod into raw C code for speed.

Any thoughts on this would be greatly appreciated, especially thoughts from 
mathematica developers. I'd do it myself, if I had access to the code that was 
compiled to make 'math.exe'... ;-)

Ed

(
  ps - thanks much for this mailing list. I just stumbled across it, and it looks
  like its going to be invaluable going forward. Is it available in digest mode?
)


  • Prev by Date: Re: Miscellaneous'WorldPlot'
  • Next by Date: Re: Sorting complex points
  • Previous by thread: Problems with Derivative, Piecewise, Assuming
  • Next by thread: Re: simplified C API call in MathLink