Wolfram ResearchProductsPurchasingServices & ResourcesAbout UsOur Sites
Mathematica Technical FAQs Services & Resources / Mathematica / MathLink
-----
 /
General Questions
*Mathematica
*Network Mathematica
*webMathematica
*gridMathematica
*Personal Grid Edition
*Wolfram Workbench
*Wolfram Education Group
*Application Packages
*Mathematica for Students
*Mathematica CalcCenter
*Publicon
*A New Kind of Science Explorer
*Mathematical Explorer
*Mathematica Teacher's Edition
*Calculus WIZ
*Mathematica Player
*Ask about this page
*Print this page
*Email this page
*Give us feedback
*
Sign up for our newsletter:

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






 © 2008 Wolfram Research, Inc.  Terms of Use  Privacy Policy | [ja] [kr]