MathGroup Archive 2005

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

Search the Archive

Re: Re: simplified C API call in MathLink

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55938] Re: [mg55918] Re: simplified C API call in MathLink
  • From: Edward Peschko <esp5 at pge.com>
  • Date: Sun, 10 Apr 2005 23:07:17 -0400 (EDT)
  • References: <d3835t$cej$1@smc.vnet.net> <200504101054.GAA29032@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On Sun, Apr 10, 2005 at 06:54:49AM -0400, ragfield wrote:
> > I was wondering if Wolfram Research had plans for a simpler API for
> mathlink.
> 
> The functionality of which you speak is very straightforward to
> implement with MathLink by wrapping ToString[ToExpression[...],
> InputForm] around the text you wish to evaluate.  In fact, I just did
> it:

Just curious, but does the following have state? Does the MLINK remember 
what variables were entered into it, so you could print them out later? 
And would you be able to export graphs back to C (using ExportString, per chance)? 
Or are there embedded nulls to worry about, and if so, how do you handle them?


If this is really as fairly straightforward to do this in a production ready way
as I think it is - and hence not much of a deal to program - then it really 
would be nice to have all of this functionality in a simple function call 
or function calls embedded into MathLink itself, and distributed by
Wolfram Research, rather than having to deal with a wrapper or wrappers.

Why? Because if it was officially supported, every single scripting language 
that wanted to embed mathematica into it could point to this 'simplified API'
functions and use them, rather than needing to reinvent the wheel every time.

Perhaps three separate functions:

	void  mathematic_3(MLINK *, char *expr, char *return);
	char *mathematic_2(MLINK *, char *expr);
	char *mathematic_1(char *expr);

which differ by how much mathlink handles memory management. Then

	mathematic_dealloc();

could be used to deallocate whatever memory the mathematic* functions 
allocated.


Ed

(ps - 

    just curious, but when you have a MLINK instance, does it count 
    as a separate process instance? I noticed that I cannot have more 
    than two 'math' processes, without mathematica complaining. Is this
    true for MLINK instances?
)


  • Prev by Date: Re: Recommendations for a programming book?
  • Next by Date: Re: Re: Computation speeds: numerical vs symbolic
  • Previous by thread: Re: simplified C API call in MathLink
  • Next by thread: Re: simplified C API call in MathLink