All programs that call MATLAB Compiler generated shared libraries have roughly the same structure:
-
Call mclInitializeApplication , 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 , and process the results. (This is the main body of the program.)
-
Call, once for each library, <libraryname>Terminate , to destroy the associated MCR.
-
Call mclTerminateApplication to free resources associated with the global MCR state.
To see these steps in an actual example, review the main program in this example, triangle.c .
m文件
void mlfSierpinski(int nargout, mxArray** x, mxArray** y,mxArray* iterations, mxArray* draw)
第一个参数是返回的参数个数,之后分别为返回参数,输入参数
triangle.c程序为: