All programs that call MATLAB Compiler generated shared
libraries have roughly the same structure:
Declare variables and process/validate
and test for success. This function sets up the global MCR state and
enables the construction of MCR instances.
Call, once for each library, <libraryname>Initialize
to create the MCR instance required by the library.
Invoke functions in the library
process the results. (This is the main body of the program.)
Call, once for each library, <libraryname>Terminate
to destroy the associated MCR.
free resources associated with the global MCR state.
Clean up variables, close files, etc.,
To see these steps in an actual example, review the main program
in this example, triangle.c
void mlfSierpinski(int nargout, mxArray** x, mxArray** y,mxArray* iterations, mxArray* draw)