How to install and compile the MEX interfaces
There are three methods (alternatives) to install and use the MEX files. With MATLAB and mex -setup
This is possible if you have a C and Fortran compiler installed which are
both supported by MATLAB.
"Bind" both compilers to MATLAB typingmex -setup at the MATLAB command prompt and choose the right option files (more information can be found at the Mathworks Support
).
You have to do this step only once.
To check if everything is prepared for compilation typemex -v If you get a list with a C-compiler (CC) and a Fortran compiler (FC) you have everything you need. Here is an example: mexconfig.txt. Then you can install a MEX Interface:
- unpack zip-File with the interface in an empty folder
- Start MATLAB and change to this directory
- call "compile", i.e. type "compile" at the MATLAB command prompt
- if there are no errors, you have got at least one
.mexsolfile (solaris) or one.dllfile (Windows, MATLAB<7.1) or one.mexw32file (Windows, MATLAB>=7.1) - Now you have two possibilities for using the interface: Either you add the directory from 1. to MATLAB's search-paths or you copy the
.mexsolor.dlland.mfiles in the directory you want to use them
With lcc-win32
This is possible if you have a Windows-PC.- Visit http://www.cs.virginia.edu/~lcc-win32/
or http://q-software-solutions.de/products/lcc-win32/index.shtml
- Download
lccwin32.exe(at the moment 3.9 Mb) - Download
fortran.exe(at the moment 0.5 Mb) at [http://www.filewatcher.com/m/fortran.exe.453574.0.0.html]] - Install
lccwin32.exe(if possible DON'T USE spaces in your installation-path, e.g.C:\lcc) - Install
fortran.exeat the exact same location (in our exampleC:\lcc) - unpack the zip file with the interface in an empty folder
- change in this directory, open a editor of your choice and edit
create.bat. You have to put in two paths (one for MATLAB and one for lcc) - start
create.batat a Dos Command Prompt (Dos-Box) - if there are no errors, you have got at least one
.dllfile - Now you have two possibilities for using the interface: Either you add the directory from 6. to MATLAB's search-paths or you copy the
.dlland.mfiles in the directory you want to use them
With OpenWatcom 1.3
This is possible if you have a Windows-PC and your MATLAB version supports OpenWatcom 1.3. To check: go in the directory<MATLAB-Path>/extern/lib/win32/watcom If there is a subfolder
openwc13 then OpenWatcom 1.3 ist supported. - Visit http://openwatcom.mirrors.pair.com/
- Dowload open-watcom-win32-1.3.exe
- Install OpenWatcom 1.3
- unpack the zip file with the interface in an empty folder
- change in this directory, open a editor of your choice and edit
create_wc.bat. You have to put in two paths (one for MATLAB and one for Watcom) - start
create_wc.batat a Dos Command Prompt (Dos-Box) - if there are no errors, you have got at least one
.dllfile - Make sure the Watcom folders
binntandbinware listed (in that order) in the PATH environment variable and start MATLAB - Now you have two possibilities for using the interface: Either you add the directory from 4. to MATLAB's search-paths or you copy the
.dlland.mfiles in the directory you want to use them
Some words about Cygwin, MingW and Gnumex
It's far behind the scope of this HowTo to explain the installation of Cygwin and/or MingW together with Gnumex. Take a look at the Gnumex homepage
.
Instead I'll give here some hints that may help you to compile and link this MEX interfaces
with gnumex. - Link to MingW (instead of Cygwin) or use a rather old version of Cygwin (cf. Warning at the gnumex homepage)
- Don't use the "rtd"-calling convention, i.e. don't use the
-mrtdflag! - Define the compiler symbols
FORTRANUPPandFORTRANNOUNDERin order to tell the MEX interfaces how the Fortran symbols are named (here in uppercase and without trailing underscore), i.e. pass the arguments-DFORTRANUPPand-DFORTRANNOUNDER
mex -v -f c:\gnumex\mexmingf.bat -DFORTRANUPP -DFORTRANNOUNDER radauMex.c options.c radau.f lapack.f lapackc.f dc_lapack.f
Questions, Problems, Bugs
Send them to Ludwig_C
gmx.de



