Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Build on Mac and Linux Operating Systems

Setting Run-Time Library Path

At run time, you must tell the Mac and Linux® operating system where the API shared libraries reside by setting an environment variable. The Mac or Linux command you use and the values you provide depend on your shell and system architecture. The following table lists the name of the environment variable (envvar) and the value (pathspec) to assign to it. The term matlabroot refers to the root folder of your MATLAB® installation.

Operating Systemenvvarpathspec

64-bit Apple Mac

DYLD_LIBRARY_PATH

matlabroot/bin/maci64:matlabroot/sys/os/maci64

64-bit Linux

LD_LIBRARY_PATH

matlabroot/bin/glnxa64:matlabroot/sys/os/glnxa64

Using the C Shell

Set the library path using the command:

setenv envvar pathspec

Replace the terms envvar and pathspec with the appropriate values from the table. For example, on a Macintosh system use:

setenv DYLD_LIBRARY_PATH
matlabroot/bin/maci64:matlabroot/sys/os/maci64

You can place these commands in a startup script, such as ~/.cshrc.

Using the Bourne Shell

Set the library path using the command:

envvar = pathspec:envvar
export envvar

Replace the terms envvar and pathspec with the appropriate values from the table. For example, on a Macintosh system use:

DYLD_LIBRARY_PATH=matlabroot/bin/maci64:matlabroot/sys/os/maci64:$DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH 

You can place these commands in a startup script such as ~/.profile.

Building the Application

To compile and link the matcreat.c example, use the mex script with the -client engine option.

copyfile(fullfile(matlabroot,'extern','examples','eng_mat','matcreat.c'),'.','f')

Use the following command to build it:

mex -v -client engine matcreat.c

To modify the build instructions for your particular compiler, use the -v -n options to view the current compiler and linker settings. Then, modify the settings using the mex varname=varvalue option.

See Also

Was this topic helpful?