Documentation Center

  • Trials
  • Product Updates

Compiling Engine Applications with IDE

Configuring the IDE

If your integrated development environment (IDE) has a MATLAB®-supported compiler, you can use the IDE to build engine applications. For an up-to-date list of supported compilers, see the Supported and Compatible Compilers website.

Engine applications require the Engine Library libeng, the Matrix Library libmx, and supporting include files. When you build using the mex command, MATLAB is configured to locate these files. When you build in your IDE, you must configure the IDE to locate them. Where these settings are depends on your IDE. Refer to your product documentation. MathWorks provides the following information for configuring specific IDEs. For using Microsoft® Visual Studio®, see http://www.mathworks.com/matlabcentral/answers/100603-how-can-i-compile-a-matlab-engine-application-using-microsoft-visual-studio-9-0-or-10-0. For using Macintosh Xcode, see http://www.mathworks.com/matlabcentral/answers/91611-how-can-i-build-an-engine-application-using-the-xcode-ide-on-mac.

To get started, use one the following to build an example to make sure the process works.

Then configure your IDE with the information displayed from the command mex -v -n filename. filename is the source file from the build example.

Engine Include Files

Header files contain function declarations with prototypes for the routines you access in the API libraries. These files are the same for Windows®, Mac and Linux® systems. Engine applications use:

  • engine.h — function prototypes for engine routines

  • matrix.h — definition of the mxArray structure and function prototypes for matrix access routines

In your IDE, set the pre-processor include path to the value returned by the following MATLAB command:

fullfile(matlabroot,'extern','include')

Engine Libraries

You need the libeng and libmx shared libraries. The name of the file is platform-specific, as shown in the following table.

Library File Names by Operating System

Windows[a]LinuxMac
libeng.dlllibeng.solibeng.dylib
libmx.dlllibmx.solibmx.dylib

[a] These files are located in the folder fullfile(matlabroot,'extern','lib',computer('arch'),'microsoft').

Add these library names to your IDE configuration. Set the library path to the value returned by the following MATLAB command:

fullfile(matlabroot,'bin',computer('arch'))

Refer to your IDE product documentation for instructions. For an example, see Technical Support solution 1-78077S at http://www.mathworks.com/support/solutions/data/1-78077S.html.

Library Files Required by libeng

The libeng library requires additional third-party library files. MATLAB uses these libraries to support Unicode® character encoding and data compression in MAT-files.

These library files must reside in the same folder as the libmx library. You can determine what these libraries are using the platform-specific commands shown in the following table. Once you identify these files, update your IDE.

Library Dependency Commands

WindowsLinuxMac

See the following instructions for Dependency Walker

ldd -d libeng.sootool -L libeng.dylib

On Windows systems, to find library dependencies, use the third-party product Dependency Walker. Dependency Walker is a free utility that scans any 32-bit or 64-bit Windows module and builds a hierarchical tree diagram of all dependent modules. For each module found, it lists all the functions exported by that module, and which of those functions are called by other modules. Download the Dependency Walker utility from the website http://www.dependencywalker.com/. See http://www.mathworks.com/matlabcentral/answers/92362-how-do-i-determine-which-libraries-my-mex-file-or-stand-alone-application-requires for information on using the Dependency Walker.

Drag and drop the libeng.dll file into the Depends window. Identify the dependent libraries and add them to your IDE configuration.

Was this topic helpful?