MATLAB:mex:ErrInvalidMEXFile : Invalid MEX-file: The specified procedure could not be found.
조회 수: 27 (최근 30일)
이전 댓글 표시
I have been facing a vicious Mex runtime error for weeks now that is significantly wasting my time without getting anywhere to resolve it. The error message is in the title of this question. Surprisingly, the compiled Mex files run smoothly under MATLAB 2023b and 2024a, but not under the older versions of MATLAB. Even stranger, I am compiling the Mex file with MATLAB 2022a, and removing all other matlab installations from the paths, and still getting this runtime error with the same MATLAB 2022a, but not with other newer installations.
What could be going wrong? How can I trace the root of this persistent error that sometimes changes to slightly different messages?
댓글 수: 10
Bruno Luong
2024년 10월 5일
편집: Bruno Luong
2024년 10월 5일
"MEX configured to use 'Microsoft Visual C++ 2022 (C)' for C language compilation.=Is microsoft CL.exe supported?"
According to the official link I post above, yes. Also if the compiler can be detected by
mex -setup
then it is supported.
답변 (1개)
Shivam Gothi
2024년 10월 7일
According to the documentation:
For best results, your version of MATLAB must be the same version that was used to create the MEX file.
MEX files use MATLAB run-time libraries. A MEX file that was created on an earlier version of MATLAB usually runs on later versions of MATLAB. If the MEX file generates errors, recompile the MEX file from the source code.
Now, addressing the issue:
"Even stranger, I am compiling the Mex file with MATLAB 2022a, and removing all other matlab installations from the paths, and still getting this runtime error with the same MATLAB 2022a, but not with other newer installations."
Based on my understanding, I have identified a workaround that might help to find the cause of the issue.
The error message highlighted by you occures in the case when MATLAB cannot find all .DLL files referenced by a MEX file.
Generally, it throws an error as shown below:
Invalid MEX-file mexfilename:
The specified module could not be found.
where “mexfilename” is the module with the dependency error. This module cannot find its dependent libraries. To resolve this error, find the names of the dependent libraries, and determine if they are present on your system and on the system path.
For windows operating system, you can use “Dependency Walker Utility” for this purpose
Dependency Walker is a tool that tracks and logs files that are accessed when an executable launches. It can also track what files are being called by a DLL or SYS file. It is able to track file registration errors, access violations, invalid page faults or even missing files. It can be downloaded from the website:
To know more about “Dependency walker utility”, refer:
you can also refer to the below MATLAB answer, which addresses somewhat similar issue:
I hope it helps!
댓글 수: 4
Bruno Luong
2024년 10월 7일
Then the issue is the compiled mex is not backward compatible, not missing DLL in my view.
참고 항목
카테고리
Help Center 및 File Exchange에서 Troubleshooting in MATLAB Compiler SDK에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!