MATLAB® provides a way to modify header file information by creating a prototype file, a file of MATLAB commands.
Like a header file, the prototype file contains the function signatures for the library. Here are some reasons for using a prototype file.
To deploy applications that use loadlibrary
(using
MATLAB
Compiler™).
To use loadlibrary
in a parallel computing
environment (using Parallel Computing Toolbox™).
To change signatures of the library functions.
To rename some of the library functions.
To use only a small percentage of the functions in the library you are loading.
To use functions with a variable number of arguments.
You can change the prototypes by editing the prototype file and reloading the library.
To create a prototype file, use the mfilename
option of the
loadlibrary
function.
For information about default thunk file names, see loadlibrary
. To change the name,
use the thunkfilename
option.
loadlibrary
To deploy a MATLAB application that uses loadlibrary
, using
MATLAB
Compiler:
Create a prototype file.
For 64-bit applications, specify a thunk file.
Include all the relevant files when creating the project with
mcc
.
loadlibrary
in Parallel Computing EnvironmentTo use loadlibrary
in a parallel computing environment (using
Parallel Computing Toolbox):
Create a prototype file.
For 64-bit applications, specify a thunk file.
Make sure that all relevant files are accessible to all workers.
Edit the prototype file, changing the fcns.LHS
or
fcns.RHS
field for that function. This edit changes the types
of arguments on the left-hand side or right-hand side, respectively.
Edit the prototype file, defining the fcns.alias
field for that
function.
Edit the prototype file, commenting out the unused functions. This edit reduces the amount of memory required for the library.
Create an alias function in a prototype file for each set of arguments you use to call the function.