MathGroup Archive 1999

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

Search the Archive

Re: How to interrupt a running evaluation in MathLink

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16964] Re: How to interrupt a running evaluation in MathLink
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 8 Apr 1999 02:32:54 -0400
  • Organization: Universitaet Leipzig
  • References: <7e9olb$3ku@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Robert,

on my SGI the abort with:

  MLPutMessage(link,MLAbortMessage);
  MLFlush(link);
  while(MLReady(link) && MLNextPacket(link)!=MENUPKT &&
MLError(link)==MLEOK) {
    MLNewPacket(link);
   }
  MLPutString(link,"a");
  if(MLError(link)) fprinf(stderr,"%s\n",MLErrorMessage(link));


works fine.


int CallMathArgc=3;
char *CallMathArgv[]= {"-linkname",
                       "/usr/local/bin/math -mathlink",
                       "-linklaunch",NULL};


and

  env=MLInitialize(0);
  link=MLOpenArgv(env,CallMathArgv,CallMathArgv+CallMathArgc,&errno);

are working on my unix box.

Regards
  Jens

RMille1 wrote:
> 
> I'm using Mathlink in my C program to start a Mathlink kernel and send this
> expression to be evaluated:
> 
> N[ReplaceAll["Some expression",x->"some variable"]]
> 
> Everything is working otay. However, occasionally an expression I send causes
> the kernel to evaluate for longer than I would like it to. So what I want to do
> is interrupt the evaluation and abort just as it would from a command line with
> Ctr-C and abort, but through MathLink. Here's the snippet of code that will
> call it:
> 

> One other thing. I found the MathLink Tutorial by Todd Gayley to be the best
> resource for learning how to use MathLink to start and run a Math kernel from
> C. However, it seems a little dated. I'm using
> 
> char *argv[5] = {"-linkname",
>                  "c:\\progra~1\\wolfra~1\\mathem~1\\3.0\\math -mathlink",
>                       "-linkmode",
>                       "launch",
>                       NULL};
> with MLOpen(), and that doesn't jive with the documentation in Mathematica 3.0
> 
> Is there a more up to date version available?


  • Prev by Date: Re: Help: Debuging Functions in Mathematica
  • Next by Date: Re: question about entering vectors by the keyboard
  • Previous by thread: Re: How to interrupt a running evaluation in MathLink
  • Next by thread: Re: How to interrupt a running evaluation in MathLink