Re: a mathlink question

*To*: mathgroup at smc.vnet.net*Subject*: [mg89654] Re: [mg89620] a mathlink question*From*: "Szabolcs HorvÃt" <szhorvat at gmail.com>*Date*: Mon, 16 Jun 2008 06:41:42 -0400 (EDT)*References*: <200806151013.GAA12268@smc.vnet.net>

On Sun, Jun 15, 2008 at 13:13, GS <vokaputs at gmail.com> wrote: > I would like to call a C-program from Mathematica. All the examples in > the MathLink tutorials (like AddTwo[i,j]) work like this: they are > called from Mathematica, are executed, send the result to Mathematica > and exit. This is not correct. The program does *not* exit unless you explicitly terminate it with Uninstall[]. This means that you can use a global or static variable normally to persist data between subsequent calls. > > I would like a C-program to not exit after the execution, and keep the > memory of the previous inputs. Say, I want an external C-program, to > be called as AddToPreviousSum[x]. When it is first called, it returns > x. When it is called the second time AddToPreviousSum[y], it returns x > +y. When it is called the third time AddToPreviousSum[z], it returns x > +y+z, and so on. > > How do I implement this in C using MathLink? > > Thanks. > GS. > >

**References**:**a mathlink question***From:*GS <vokaputs@gmail.com>