This change has been incorporated into the documentation in Release 2011a (R2011a). For previous releases, read below for any additional information:
With MATLAB Compiler 4.0 (R14) and later, you can use MATLAB file prototypes as described below to load your library in a compiled application. Note that 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 below:
loadlibrary(library, header)
In order to workaround this issue, execute the following command at the MATLAB commmand prompt:
loadlibrary(library, header, 'mfilename', 'mHeader');
... where mHeader is the name of a MATLAB file (in this case mHeader.m) that you would like to use when loading this library. This step only needs to be performed once to generate an MATLAB file for the library.
Now, in the code that is be compiled, you can call LOADLIBRARY with the following format:
loadlibrary(library, @mHeader, 'alias', alias)
With MATLAB Compiler versions 4.0.1 (R14+) and above, the generated MATLAB file mHeader.m will automatically be included in the CTF file as part of the compilation process. For versions 4.0 of the Compiler (R14) and later, include your library MATLAB file in the compilation with the '-a' option with MCC.
Note: With the MATLAB Compiler 3.0 (R13SP1) and earlier versions you cannot compile calls to LOADLIBRARY because of general restrictions and limitations of the MATLAB Compiler.
If you do not have a header file, the prototype file can be created manually. Follow the example in the documentation to generate a prototype file and modify it to suit the shared library you would like to use:
web([docroot,'/techdoc/ref/loadlibrary.html'])
Best Answer