Invalid MEX-file: A dynamic link library (DLL) initialization routine failed.

21 views (last 30 days)
For building a mex file, I implemented a C++ class and overloaded the operater() operator.
However this C++ file does also contain a global variable, which also makes sense in this particular use case. Unfortunately I face some problems when calling the compiled mex function from matlab. Except at some very rare cases where everything works as expected, I usually get the fallowing error in the MATLAB console wenn calling the mex function:
Invalid MEX-file '<path>\<MexName>.mexw64': A dynamic link library (DLL) initialization routine failed.
The error is thrown after a long (approx 30 sec) MATLAB freeze . Sometimes the MATLAB IDE even crashes down.
This error does never occur if i build the same C++ mex without this global variable. Restarting MATLAB, the computer, or clear('all') does not help.
I use Microsoft Visual C++ 2017 and Microsoft Visual C++ 2019 compiler and MATLAB R2019b

Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!