What Types of Files Define Your Library?
To build (publish) a MATLAB® interface to a C++ library, you need:
One or more header or source files that contain declarations of all the functions exported by the library. You should be able to compile these files in a C++ development environment and use the functionality in C++ applications.
A compiled library file —
.dll
on Windows®,.so
on Linux®, or.dylib
on macOS. If the library is completely defined in the header or source files, then the library file is optional.If you build the library in debug mode, it might be incompatible with MATLAB, causing an access violation and the program to terminate or crash. On Windows, to ensure that a debug build uses the same C/C++ run-time library as MATLAB, see Resolve Incompatible Debug Build for C++ Library on Windows.
MATLAB does not support 32-bit libraries.
An import library file —
.lib
on Windows. If the library is compiled with a supported Microsoft® Visual Studio® compiler, then you need only the shared library.dll
file.A static library file —
.a
on Linux and macOS platforms, and on Windows if the library is compiled with a supported MinGW® compiler.The C++ compiler that was used to build the C++ library.
For information about building an interface, see How to Publish a MATLAB Interface to a C++ Library. The first step is to generate a MATLAB library definition file depending on what types of files define your library. Your library might contain combinations of header files, CPP source files, and compiled library files.