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

1 view (last 30 days)
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?

Answers (0)

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!