User`s guide
7 Libraries
Caution mclInitializeApplication can only b e called once per
applicatio n . Calling it a second time generates an error, and will cau se the
function to return
false. This function must be called before calling any
C-Mex function or MAT-file API function.
Using a Shared Library
To use a MATLAB Compiler generated shared library in your application,
you must perform the following steps:
1 Include the generated header file for each library in your application. Each
MATLAB Compiler generated shared library has an associated header file
named
libname.h,wherelibname is the library’s name that was passed in
on the command line when the library was compiled.
2 Initialize the MATLAB libraries by calling the mclInitializeAppli cation
API function. You must call this function once per application, and it must
be called before calling any other MATLAB API functions, such as C-Mex
functions or C MAT-file functions.
mclInitializeApplication must be
called before calling any functionsinaMATLABCompilergenerated
shared librar y. You may option al ly pass in application-level options to this
function.
mclInitializeApplication returns a Boolean status code. A
return value of
true indicates successful in iti al iz ation , and false indicates
failure.
3 For e ach MATLAB Compiler generated shared library that you include in
your application, call the library’s initiali zation f unction. This function
performs several library-local initializations, such as unpacking the CTF
archive, and starting an MCR instance with the necessary information to
execute the code in that archive. The library initialization function will be
named
libnameInitialize(),wherelibname is the library’s name that
was passed in on the command line when the library was compiled. This
function returns a Boolean status code. A return value of
true indicates
successful initialization, and
false indicates failure.
7-14