On Fri, Jan 16, 2009 at 10:20 AM, Alexey Afanasyev <aphongka at yandex.ru> wrote:
> I am a newbie in Maxima. I am writing a program in C++ and wish to use
> Maxima in it. How can I interoperate with Maxima?
>
> I have found that one of the possible ways is using sockets. Is this the
> only way? Is there any documentation on the topic?
Take a look at http://maxima.sourceforge.net/relatedprojects.html --
in many cases there is a front end written some other language
which talks to Maxima via a socket. (E.g. XMaxima and wxMaxima.)
Maybe you can get some ideas from them.
If you are working with sockets you might consider
share/contrib/maxima-server.lisp
which implements a simple ordinary Unix server which forks a new
instance of Maxima for each socket connection. It works only with
SBCL; should be possible to port it to other Lisps which have fork, etc.
There is also the possibility of linking directly through a so-called
foreign function interface. Several Lisp varieties have their own, also
there is one named CFFI which works for several of them (notably,
excluding GCL).
Maxima was originally written with a pervasive assumption that there
is always someone at the console. In particular Maxima tries to gather
user input via the asksign function (which asks questions like
"Is x positive, negative, or zero?"). Each program which calls Maxima
has to deal with that in some way. Take a look at the related projects
page to get some ideas about that.
Hope this helps, & good luck. What kind of a program are you writing?
Robert Dodier