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

28 Ansichten (letzte 30 Tage)
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?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 15 Mai 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".

Weitere Antworten (0)

Kategorien

Mehr zu C Shared Library Integration finden Sie in Help Center und File Exchange

Produkte


Version

R2011b

Community Treasure Hunt

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

Start Hunting!

Translated by