I'm a digitial designer that needs to break up the matlab compiler output into seperate functions so i can call them via DPI from my SystemVerilog code.
I took your matrixdriver example from teh compilersdk directory and got that working.
Then I split out all the init and terminate functions from the run_main and place them around the call to mclrunmain, see code at the end for modified main file.
This is how i want to call it in my SystemVerilog.
When I do this the application crashes.
If i move all the init and termintates back into the run_main, ti works fine.
Everything i see about mclrunmain says it doesn't matter when running on Linux.
So I removed the mclrunmain call it works fine.
What features if any am I missing out on if i don't use the mclrunmain function and why do the init and terminates need to be inside it?
/* Call the mclInitializeApplication routine. Make sure that the application
* was initialized properly by checking the return status. This initialization
* has to be done before calling any MATLAB API's or MATLAB Compiler generated
* shared library functions. */
if( !mclInitializeApplication(NULL,0) )
fprintf(stderr, "Could not initialize the application.\n");
/* Call the library intialization routine and make sure that the
* library was initialized properly. */
fprintf(stderr,"Could not initialize the library.\n");
/* Call the library termination routine */
/* Note that you should call mclTerminate application at the end of
* your application.