External Interfaces/API |
Compiling and Linking on UNIX
Under UNIX at runtime, you must tell the system where the API shared libraries reside. These sections provide the necessary UNIX commands depending on your shell and system architecture.
Setting Runtime Library Path
In C shell, the command to set the library path is
In Bourne shell, the commands to set the library path are
where <matlab>
is the MATLAB root directory and $Arch
is your system architecture (alpha
, glnx86
, sgi
, sol2
, hp700
, or ibm_rs
).
Note that the environment variable (LD_LIBRARY_PATH in this example) varies on several platforms. The following table lists the different environment variable names you should use on these systems.
Architecture |
Environment Variable |
HP700 |
SHLIB_PATH |
IBM RS/6000 |
LIBPATH |
It is convenient to place these commands in a startup script such as ~/.cshrc
for C shell or ~/.profile
for Bourne shell.
Using the Options File
MATLAB provides an options file, matopts.sh
, that lets you use the mex
script to easily compile and link MAT-file applications. For example, to compile and link the matcreat.c
example, you can use
where <pathname>
specifies the complete path to the specified file.
If you need to modify the options file for your particular compiler or platform, use the -v
switch to view the current compiler and linker settings and then make the appropriate changes in a local copy of the matopts.sh
file.
Compiling and Linking MAT-File Programs | Compiling and Linking on Windows |