This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
Mathematica System Program

mprep

mprep options template.tm
preprocesses the MathLink template file template.tm, generating a C file called filename that contains all the necessary MathLink code to call C functions from Mathematica.
  • mprep processes .tm template files that describe interfaces between Mathematica functions and C functions. These interfaces allow Mathematica to call the C functions from within the Mathematica runtime.
  • mprep generates the necessary set of C MathLink API function calls to communicate with the Mathematica kernel automatically. Users can take the C code generated by mprep, compile it and link it with the rest of their C program. The resulting program is suitable for use with Install.
  • mprep supports the following command-line arguments:
-prototypesenable use of ANSI C function prototypes (default)
-noprototypesdisable use of ANSI C function prototypes for compilers that do not support ANSI C prototypes
-linesenable recording of source line and source file location in output C file
-nolinesdisable recording of source line and source file location in output C file
-h filenameuse the contents of filename as custom header code in the output C file rather than the default header code produced by mprep (use with care)
-t filenameuse the contents of filename as custom trailer code in the output C file rather than the default trailer code produced by mprep (use with care)
-o filenamewrite output to the file named filename
-cforce mprep to output C code compatible with the Carbon library on Mac OS X (Mac only)
-dforce mprep to output C code compatible with the BSD layer on Mac OS X (Mac only)
-j filenameread a list of filenames from filename and process each file in batch mode
  • With -lines, entries from the template files will be preceded by # line line-number "sourcefile".