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

조회 수: 15 (최근 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
MathWorks Support Team 2013년 5월 15일
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