Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Why does mclrunmain segfault when i call libmatixTerminate outside of mclrunmain?

조회 수: 1 (최근 30일)
Eric Jackowski
Eric Jackowski 2019년 1월 16일
마감: MATLAB Answer Bot 2021년 8월 20일
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?
int main()
{
/* 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");
return -1;
}
/* Call the library intialization routine and make sure that the
* library was initialized properly. */
if (!libmatrixInitialize()){
fprintf(stderr,"Could not initialize the library.\n");
return -2;
}
mclRunMain((mclMainFcnType)run_main,0,NULL);
/* Call the library termination routine */
libmatrixTerminate();
/* Note that you should call mclTerminate application at the end of
* your application.
*/
mclTerminateApplication();
}

답변 (0개)

제품


릴리스

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by