MATLAB:mex:ErrInvalidMEXFile : Invalid MEX-file: The specified procedure could not be found.
36 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Bruno Luong
il 5 Ott 2024
Modificato: Bruno Luong
il 5 Ott 2024
"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.
Risposte (1)
Shivam Gothi
il 7 Ott 2024
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 Commenti
Bruno Luong
il 7 Ott 2024
Then the issue is the compiled mex is not backward compatible, not missing DLL in my view.
Vedere anche
Categorie
Scopri di più su Troubleshooting in MATLAB Compiler SDK in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!