Mathematica supports the MathLink communication standard, which
allows higher-level communication between Mathematica and external programs.
To use MathLink, an external program has to include some special source code,
which is distributed with Mathematica. MathLink is a library of functions
that implement a protocol for sending and receiving Mathematica expressions.
Its uses fall into two general categories.
The most common use is to allow external functions written in other languages to
be called from within the Mathematica environment. If you have an algorithm that
needs to be implemented in a compiled language, or if you have code that you do not want
to rewrite in Mathematica, you can easily incorporate the routines into
Mathematica.
The second use of MathLink is to allow your program, running in the foreground,
to use the Mathematica kernel in the background as a computational engine. This
requires a deeper understanding of MathLink.
The following references provide more information on MathLink.