What Types of Files Define Your Library?
R2026bIf you have a C or C++ compiled library that exports functionality for use by other applications, you can create a MATLAB® interface to call its classes and functions. To build (publish) the interface, you need C/C++ header files, source files, and/or compiled library files. For information, see How to Publish a MATLAB Interface to a C/C++ Library.
The first step is to generate a MATLAB
clibgen.api.InterfaceDefinition object depending on what types of files define
your library. Your library might contain:
One or more header or source files that contain declarations of all the functions exported by the library. You can compile these files in a C++ development environment and use the functionality in C++ applications.
A compiled library file —
.dllon Windows®,.soon Linux®, or.dylibon 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 —
.libon Windows. If the library is compiled with a supported Microsoft® Visual Studio® compiler, then you need only the shared library.dllfile.A static library file —
.aon 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.