User`s guide

7 Libraries
most likely this is the version your application w ill call. In this example, this
form of the i nitialization function is called
libtriangleInitialize.
bool libtriangleInitia lize (void)
This function creates an MCR instance using the default print and error
handlers, and other information generated d uring the compilation process.
However, if you want more control over ho w printed output and error
messages are handled, yo u may call the second form of the function, which
takes two arguments.
bool libtriangleInitia lize WithHandlers(
mclOutputHandlerFcn error_handler,
mclOutputHandlerFcn print_handler
)
By calling this function, you can provide your own versions of the print
and error h an d ling routines called by the MCR. Each of these routines has
the same signature (for complete details, see “Print and Error Handling
Functions” on page 7-27). By overriding the defaults, you can control how
output is displayed and, for example, whether or not it goes into a log file.
Note Before calling either form of the library initialization routine, you must
first call
mclInitializeApplication to set u p the global MCR state. See
“Calling a Shared L ibrary” on page 7-11 for more information.
On Microsoft Windows platforms, MATLAB C ompiler generates an additional
initialization function, the standard Microsoft DLL i nitialization function
DllMain.
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason,
void *pv)
The g enerated DllMain performs a very important service; it lo cates the
directory in which the shared library is stored on disk. This information is
used to find the C TF archive, without w hich the application will not run. If
7-26