- Protofiles allow you to provide prototypes for a library for which you do not have a header file
- Providing a protofile to 'loadlibrary' instead of a header file can dramatically speed up execution.
How do I use a protofile with 'loadlibrary'?
7 views (last 30 days)
Show older comments
MathWorks Support Team
on 11 Sep 2017
Answered: MathWorks Support Team
on 11 Sep 2017
How do I use a protofile with 'loadlibrary'?
Accepted Answer
MathWorks Support Team
on 11 Sep 2017
Protofiles provide two benefits when using 'loadlibrary':
The following code gives an example of how to use a protofile:
if ~libisloaded(libname)
% If the protofile already exists
if exist('myProtofile', 'file') == 2
% Load the library using the protofile, this is much faster
loadlibrary(libname, @myProtofile);
else
% Load the library using the header file, generating the protofile
% Will create a file name 'myProtofile.m' in the current
% directory.
loadlibrary(libname, headerFile, 'mfilename', 'myProtofile.m');
end
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Call C from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!