Borrar filtros
Borrar filtros

mclmcrInitialize fails from C++ Linux call

3 visualizaciones (últimos 30 días)
Stephanie Lilly
Stephanie Lilly el 22 de Jul. de 2019
Respondida: Prasad Parameswaran el 26 de Feb. de 2020
I have a compiled Matlab model which I compiled using mcc into a shared library.
I call the shared library from C++ code.
This all previously worked under Red Hat 5.5. Now we are on Red Hat 6.9.
Using the same code when I call mclmcrInitialize() from my C++ code I get the following error:
in mclmcrInitialize2_Proxy() from libmwmclmcrrt.so
seg Fault: foundation::msg_svc::threatUtil::CountedMutex::lock() from /sw/MCR/v90/bin/glnxa64/libmwms.so.
Also in the debugger at the time of the crash I see mclAddCanonicalPathMacro_proxy from libmwmclmcrrt.so.
I'm using Matlab 2015b and SDK version 6.1
Thanks.

Respuestas (1)

Prasad Parameswaran
Prasad Parameswaran el 26 de Feb. de 2020
On Linux, you get the segmentation fault because you have not allocated memory for the output pointer of pointers. To resolve the crash, you can declare the output variable as a pointer of pointers and then allocate memory, as below:
mxArray **out;
/*This line is necessary when compiled with GCC compiler on Linux*/
out = mxCalloc(1, sizeof(mxArray*));
/*call compiled function*/
mlfToySatDR(1, out, in1);
/*do other stuff*/
/*dispose of pointers properly*/
mxDestroyArray(out[0]);
mxFree(out);

Categorías

Más información sobre C Shared Library Integration en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by