This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Build Engine Applications with IDE

You can use the MATLAB® Editor to write your engine application code and the mex command to build it. If you prefer to use an integrated development environment (IDE) such as Microsoft® Visual Studio® or Xcode to write your source code, you can still use the mex command. However, to build your application with your IDE, follow the guidelines in the following topics.

Configuring the IDE

To use your integrated development environment to build engine applications, your IDE needs a MATLAB-supported compiler. For an up-to-date list of supported compilers, see Supported and Compatible Compilers.

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.

Engine Include Files

Header files contain function declarations with prototypes for the routines you access in the API libraries. These files are in the matlabroot\extern\include folder and are the same for Windows®, macOS, 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. Add these library names to your IDE configuration. Refer to your IDE product documentation for instructions.

Windows Libraries

Microsoft

  • Engine library — matlabroot/extern/lib/win64/microsoft/libeng.lib

  • MATLAB matrix library — matlabroot/extern/lib/win64/microsoft/libmx.lib

MinGW

  • Engine library — matlabroot/extern/lib/win64/mingw64/libeng.lib

  • MATLAB matrix library — matlabroot/extern/lib/win64/mingw64/libmx.lib

Linux Libraries

  • Engine library — matlabroot/extern/bin/glnxa64/libeng.so

  • MATLAB matrix library — matlabroot/extern/bin/glnxa64/libmx.so

macOS Libraries

  • Engine library — matlabroot/extern/bin/maci64/libeng.dylib

  • MATLAB matrix library — matlabroot/extern/bin/maci64/libmx.dylib

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

Windows Linux macOS

See the following instructions for Dependency Walker

ldd -d libeng.sootool -L libeng.dylib

To find library dependencies on Windows systems, use the third-party product Dependency Walker. This free utility scans Windows modules 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. See 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.

Related Topics

External Websites