How do I use LOADLIBRARY in a deployed program generated from MATLAB Compiler?

28 views (last 30 days)
I want to deploy a MATLAB program that uses LOADLIBRARY function, but LOADLIBRARY requires a compiler.
Is there anyway to I can deploy a program onto a computer that does not require install a compiler?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 15 May 2013
The compiler is not needed on deployed machine.
One can generate prototype files, and pack them using -a option together with MCC.
Here is an example:
At command line :
loadlibrary('shrlibsample','shrlibsample.h','mfilename','mylibraryfile');
This would generates all the prototype files , including a m file called "mylibraryfile.m", which provides LOADLIBRARY entry point.
This command would only need to be performed once.
In deployed program, you may use LOADLIBRARY in this way:
loadlibrary('shrlibsample', @mylibraryfile);
libfunctions('shrlibsample','-full');
The next step is to use MATLAB compiler to compile the program, you would need to include the prototype files in the project.
For example in a 64 bit MATLAB, you would need to include:
1.mylibraryfile.m
2.shrlibsample.dll
3.shrlibsample_thunk_pcwin64.dll
mcc -v -m out.m -a 'mylibraryfile.m' -a 'shrlibsample.dll' -a 'shrlibsample_thunk_pcwin64.dll'
out.m is the MATLAB program that uses LOADLIBRARY to load the file "mylibraryFile".

More Answers (0)

Categories

Find more on C Shared Library Integration in Help Center and File Exchange

Products


Release

R2011b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!