How do I install functions from an external program?
 Mathematica provides a simple way to use MathLink to call functions within an external program and receive results back. When you build an external program and link it up with Mathematica, your external functions become defined in Mathematica, which allows you to use them in expressions just like any other Mathematica function. To use functions from an external C program in Mathematica, you should compile the program using the special tools provided with Mathematica or the MathLink Developer Kit. Then use Install["program"] inside Mathematica. Here is the step-by-step procedure. | | Write the external function of functions as a C program. |
| | Write a MathLink template file associating each external function with a Mathematica pattern. |
| | Process and compile with the mcc (Unix version only) or mprep. |
| | Use Install["name"] in Mathematica, specifying the name of your compiled external program. |
| | Access the functions from Mathematica by the names given in the template file. |
| | When you are finished using the installed funcions, remove them by using Uninstall[link], specifying the LinkObject expression that was returned by Install. |
Download this FAQ as a Mathematica 5.2 Notebook
Questions or comments? Send email to support@wolfram.com.
|