Skip to Main Content Skip to Search
Product Documentation

MATLAB Library Loading

With MATLAB Compiler version 4.0 (R14) and later, you can use MATLAB file prototypes as described below to load your library in a compiled application. Loading libraries using H-file headers is not supported in compiled applications. This behavior occurs when loadlibrary is compiled with the header argument as in the statement:

loadlibrary(library, header)

In order to work around this issue, execute the following command at the MATLAB command prompt:

loadlibrary(library, header, 'mfilename', 'mylibrarymfile'); 

where mylibrarymfile is the name of a MATLAB file you would like to use when loading this library. This step only needs to be performed once to generate a MATLAB file for the library.

In the code that is be compiled, you can now call loadlibrary with the following syntax:

loadlibrary(library, @mylibrarymfile, 'alias', alias)

With MATLAB Compiler versions 4.0.1 (R14+) and later, generated MATLAB files will automatically be included in the CTF file as part of the compilation process. For MATLAB Compiler versions 4.0 (R14) and later, include your library MATLAB file in the compilation with the -a option with mcc.

  


Free MATLAB Compiler Interactive Kit

Learn how to build standalone executables and C/C++ shared libraries from MATLAB code.


Get free kit

Trials Available

Try the latest version of MATLAB Compiler.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS