2.13.1 How MathLink Is Used
Most of this book has been concerned with how human users interact with Mathematica. MathLink provides a mechanism through which programs rather than human users can interact with Mathematica.
Some typical uses of MathLink.
MathLink provides a general interface for external programs to communicate with Mathematica. Many standard software systems now have MathLink compatibility either built in or available in add-on modules.
In addition, the MathLink Developer Kit bundled with most versions of Mathematica provides the tools you need to create your own MathLink-compatible programs.
Once you have a MathLink-compatible program, you can transparently establish a link between it and Mathematica.
The link can either be on a single computer, or it can be over a network, potentially with a different type of computer at each end.
A few uses of MathLink-compatible programs.
MathLink-compatible programs range from very simple to very complex. A minimal MathLink-compatible program is just a few lines long. But it is also possible to build very large and sophisticated MathLink-compatible programs. Indeed, the Mathematica notebook front end is one example of a sophisticated MathLink-compatible program.
The basic idea of MathLink.
Much of the power of MathLink comes from its use of Mathematica expressions. The basic idea is that MathLink provides a way to exchange Mathematica expressions between programs, and such expressions can represent absolutely any kind of data.
A few examples of data represented by Mathematica expressions in MathLink.
The MathLink library consists of a collection of routines that allow external programs to send and receive Mathematica expressions.
The MathLink Developer Kit provides utilities for incorporating these routines into external programs. Utilities are included for a variety of languages, although in this chapter we discuss mainly the case of C.
An important feature of the MathLink library is that it is completely platform independent: it can transparently use any interprogram communication mechanism that exists on your computer system.