This page briefly documents how to configure MEX compilation environment for use with the use_dll-option of model.

Octave

Octave comes with capacities for compiling MEX-file. However, under Linux, you might have to install the liboctave-dev.

MATLAB

If you are using MATLAB, please check the list of supported compilers for your MATLAB version on your operating system. After installing your compiler, select it using mex -setup in Matlab and clicking on the required compiler.

Linux

Under Linux you need to have a working compilation environment installed. If not already present, it can be installed via

apt-get install build-essential

(requires root privileges). This will set up gcc

macOS

If you are using Matlab under Mac OS X, you should install the latest version of XCode

Windows

Two compilers are currently supported by Matlab: Microsoft's Visual C++ (MSVC) (free in its Commmunity edition) and, since Matlab R2015b, the MinGW-w64 C/C++ Compiler from TDM-GCC. To install this compiler, use the Add-Ons menu of MATLAB. Search for MinGW or select it from Features. For older version of MATLAB, in particular before R2014a, it may sometimes make sense to use the GNU C compiler (gcc) from Cygwin.

Under Windows when calling Dynare with the use_dll-option, you need to tell Dynare which compiler you are using:

dynare modfilename msvc

dynare modfilename mingw

dynare modfilename cygwin

Legacy information

Before Matlab R2014, MEX-compiling was governed by a bat-file, later versions work via (more involved) xml-files. Here, we provide a description on how to set up Cygwin using the bat-file option. If you have a newer Matlab version, you have to either figure out how to translate the bat-file settings to xml or, even better, use one of the two other compilers available.

Configuring MATLAB versions before R2014a with GNU C compiler (gcc) from Cygwin

Configuring MATLAB releases before R2010a with Microsoft Visual C++ (MSVC)

Earlier versions of Matlab before R2010a do not support Visual Studio 2010:

DynareWiki: ConfigureMatlabWindowsForMexCompilation (last edited 2016-10-15 12:21:08 by JohannesPfeifer)