Error while executing a mex file that calls a DLL that was produced from Matlab Library Compiler

1 次查看(过去 30 天)
I divided my code into two parts:
  • First section - Matlab code that compiles in Matlab coder. [Matlab -->C++]
  • Second section - Matlab code that will not compile in Matlab coder.
I compiled the code that will not compile in Matlab coder using Matlab Library Compiler to a DLL, Lets call that MatlibCom.dll. then I repacked that DLL (MatlibCom.dll) into an extern "C" function using another DLL I made, lets call that DLL MyDll.dll. [Matlab --> Matlab Library Compiler --> C++ ((MatlibCom.dll)]
Finally, I compiled the first section of my code in Matlab coder and used coder.ceval(...) function in order to execute MyDll.dll (that will finally execute MatlibCom.dll).
Clarification-
  • I tested MatlibCom.dll in C++ and it worked OK.
  • I tested MyDll.dll in C++ and it worked OK.
  • The first commend of executing a matlab library compiler code - must be a
mclInitializeApplication(...);
%and later on
% Something like MY_MATLAB_LIBRARY_NAME_Initialize(..)
MatlibComInitialize();
  • My final C++ code work OK (Tested from visual studio)
The problem is executing a mex file from my final code. Generating mex file works OK, however executing a mex file crash Matlab.
I tried to debug mex file using Visual studio, it's turn out that my first call to - mclInitializeApplication(...) return false (Also MatlibComInitialize() return false). than execution anything from mcl library crashes.
Is there a problem mixing mex with matlab library compiler runtime?
Is there a way solving this?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 C Shared Library Integration 的更多信息

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by