mex function error in Win32

9 views (last 30 days)
Steve
Steve on 28 Sep 2011
I have an old mex function that is inside a dll running in Windows XP. When I run MatLab 5 the function works ok, but when I run MatLab R2007b it comes up with the following error:
??? Invalid MEX-file 'C:\myfile.dll':
C:\myfile.dll is not a valid Win32 application.
What does this mean, why does it work in MatLab 5 & not R2007b; what can be done about this?

Answers (2)

Wayne King
Wayne King on 28 Sep 2011
Hi, please see:
The section:
New File Extension for MEX-Files on Windows Systems

Kaustubha Govind
Kaustubha Govind on 28 Sep 2011
It looks like your R2007b is a 64-bit installation, but you are attempting to load a 32-bit DLL/MEX file on it. You need to re-compile your MEX function as 64-bit binary. Alternatively, you need to install 32-bit MATLAB on your 64-bit machine (see here for caveats).
  2 Comments
Steve
Steve on 28 Sep 2011
no its definitly a 32 bit installation.
Kaustubha Govind
Kaustubha Govind on 28 Sep 2011
Does your MEX-file attempt to load other DLLs? Perhaps the system path in the R2007b environment somehow does not contain the path to these additional DLLs. You can check it your DLL file has any dependencies by using Dependency Walker: http://www.mathworks.com/support/solutions/en/data/1-2KUXT0/index.html?solution=1-2KUXT0

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!