Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1996

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

Search the Archive

Re: MathLink questions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4201] Re: [mg4138] MathLink questions
  • From: John Fultz <jfultz>
  • Date: Thu, 13 Jun 1996 23:10:50 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

> Recently there has been some discussion of MathLink here
> so I thought I could throw in my own trouble.
> 
> I want to add some numerical functions written in C to 
> Mathematica. Eventually I managed to do so (using CodeWarrior),
> and it works fine. But:
> 
> i) in 3 of 4 cases, mprep crahes. It crashes less frequently if
>    I turn off the memory manager (I am using a power mac 7100).

Try turning off the General Controls control panel.  There is a bug in
this control panel which can cause SAmprep to crash.

> ii) I have some mysterious crashes when running the compiled program with
>     Mathematica like  a frozen cursor. Is there a way to find out whether
>     my own program causes the trouble (without tracing through the program).

I don't think you'll be able to get out of tracing your program.  However,
one preliminary thing you can do before pulling out the debugger is put
some MLEvaluate() statements through your code.  For example:

     MLEvaluate(stdlink, "Print[\"Made it to checkpoint 1\"]");
     while(MLNextPacket(stdlink) != RETURNPKT) MLNewPacket(stdlink);
     MLNewPacket(stdlink);

You can litter these kinds of statements throughout your code (perhaps you'll
want to define this as a macro) to help you track down the point where a
crash happens.

> iii) And actually, how fast is MathLink? That is, should I dare to call
>     a MathLink function 10^6 times or should I rather do the whole computation
>     in my program and write the result to a giant hard disc?

I wouldn't recommend making thousands of individual calls for small bits
of data in a speed critical application.  MathLink will be more efficient
if you can cache the information inside your program, and send it back
in one big chunk when necessary.  Remember that even installable MathLink
programs maintain state from one MathLink call to the next--instead of storing
the information in a file, you can just store up the information in a
memory location pointed to by a global or static variable.


> Matthias

Sincerely,

John Fultz
jfultz at wolfram.com
Applications Group
Wolfram Research, Inc.

==== [MESSAGE SEPARATOR] ====


  • Prev by Date: windows mathlink
  • Next by Date: Stieltjes Integrals in Mathematica?
  • Previous by thread: Re: MathLink questions
  • Next by thread: Kei Ker from Bessel functions