User`s manual

1 Calling C and Fortran Programs from MATLAB
1-24
in a subdirectory of your user profile directory, named Application
Data\MathWorks\MATLAB
. Under Windows NT and Windows 95/98 with user
profiles enabled, your
user profile directory is
%windir%\Profiles\username. Under Windows 95/98 with user profiles
disabled, your
user profile directory is %windir%. Under Windows 95/98, you
can determine whether or not user profiles are enabled by using the
Passwords control panel.
Custom Building on UNIX
On UNIX systems, there are two stages in MEX-file building: compiling and
linking.
Compile Stage
The compile stage must:
Add
<matlab>/extern/include to the list of directories in which to find
header files (
-I<matlab>/extern/include)
Define the preprocessor macro
MATLAB_MEX_FILE (-DMATLAB_MEX_FILE)
(C MEX-files only) Compile the source file, which contains version
information for the MEX-file,
<matlab>/extern/src/mexversion.c
Link Stage
The link stage must:
Instruct the linker to build a shared library
Link all objects from compiled source files (including
mexversion.c)
(Fortran MEX-files only) Link in the precompiled versioning source file,
<matlab>/extern/lib/$Arch/version4.o
Export the symbols mexFunction and mexVersion (these symbols represent
functions called by MATLAB)
For Fortran MEX-files, the symbols are all lower case and may have appended
underscores. For specific information, invoke the
mex script in verbose mode
and examine the output.