Invalid MEX-file, likely missing .dll

12 views (last 30 days)
Kaare
Kaare on 19 Jun 2014
Commented: Walter Roberson on 26 Feb 2017
In matlab 2012a on win 7 I am trying to install the otherwise very good MySQL Data Connector. However, when trying to run the generated mex-file, I get
Invalid MEX-file {path}: The specified module could not be found.
where {path} is the full path of the .mex64-file. The mex-call looks like this:
mex -I"C:\Program Files\MySQL\MySQL Server 5.6\include" -DWIN32 C:\Users\kaare\Dropbox\matlabTools\mysql.cpp "C:\Program Files\MySQL\MySQL Server 5.6\lib\libmysql.lib"
This returns no errors, and is in line with the instructions in the .cpp-file.
When running "dependency walker" on the faulty mex-file, I find that libmx.dll, libmex.dll and libmysql.dll seem to be missing in action. I assume the first two are included by matlab, and I'm not sure what the problem is with the last, since libmysql.dll is exactly in the position specified.
Has anyone got any suggestions about what might be failing?
I have no found contact information on the original author, who seems largely to have abandoned the function. Is anyone familiar with a good alternative for accessing a mySQL server from within matlab?

Answers (4)

Madhura Suresh
Madhura Suresh on 19 Jun 2014
Have you tried the database toolbox?
  1 Comment
Kaare
Kaare on 19 Jun 2014
Edited: Kaare on 19 Jun 2014
for the past few hours ... it seems extremely unwieldy, and I don't quite comprehend the intended use case. the beauty of the "mysql"-package was that you could just put in regular commands, and they would work exactly as expected. essentially it was simply a window into mysql, which didn't get in your way.

Sign in to comment.


Kaustubha Govind
Kaustubha Govind on 19 Jun 2014
Could you please explain this statement: "libmysql.dll is exactly in the position specified" - how do you specify this path? Typically the path to DLLs need to be added to the System PATH environment variable to be picked up at runtime. You may need to restart MATLAB after changing the System variable, so that the change gets picked up. Alternately, you can use the MATLAB setenv command to set the variable for that session.
If you ran Dependency Walker outside of MATLAB, it could just be that libmx.dll and libmex.dll are not on the System PATH, but should be resolved by MATLAB. So that could just be noise that you can ignore.
  1 Comment
Kaare
Kaare on 19 Jun 2014
I simply meant that in the mex-call the full path to libmysql.dll is given, and that this path is the correct one. how would I go about testing your suggestion? Since posting my question, I have seen some people guessing that the problems could be due to the newest versions of mysql being 32-bit only. I don't quite buy that, since I have previously gotten this to work on 64-bit linux.

Sign in to comment.


Ken Atwell
Ken Atwell on 20 Jun 2014
Try running Dependency Walker from inside MATLAB:
>> !\path\to\depends.exe
This will give you MATLAB's "view" of your system (and libmx.dll et al will almost certainly be seen). I suspect the MySQL .DLL is not on the system path inside of MATLAB. In this case, you may need to fiddle with your path -- see setenv.

Rasa Karapandza
Rasa Karapandza on 26 Feb 2017
Hi I have a similar problem. Mex works fin within mailable, but when compiled, throws the sam error. But dependencywalker dođeš not reveal much. Any help would be appreciated.
  1 Comment
Walter Roberson
Walter Roberson on 26 Feb 2017
The API-MS-WIN are false detections from Dependency Walker

Sign in to comment.

Tags

Products

Community Treasure Hunt

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

Start Hunting!