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

28 次查看(过去 30 天)
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?

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 C Shared Library Integration 的更多信息

产品


版本

R2011b

Community Treasure Hunt

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

Start Hunting!

Translated by