32 bit mex with 32 bit MATLAB on Windows 7 64 bit OS failure to run

I have a 32 bit mex that worked properly with R2011a (32bit) on Windows XP, but when I installed R2011a (32bit) on Windows 7 64 bit I get the following error message:
??? Invalid MEX-file 'C:\code\myfunction.mexw32': The specified module could not be found.
I was under the impression that R2011a 32 bit is supported on Windows 7 64 bit OS. What is going wrong here?

回答 (3 件)

Jan
Jan 2011 年 5 月 17 日

1 投票

Did you install the 32-bit runtimes of the used compiler?
EDITED: I got this message when I tried to run MEXW32 file compiled with MSVC or OWC, but forgot to install the runtime libs also. You can use the DependencyWalker to find the needed libs. See Kaustubha's answer.

1 件のコメント

Jonathan
Jonathan 2011 年 5 月 17 日
I did not. I am not sure what compiler was used in the past.

サインインしてコメントする。

Jason Ross
Jason Ross 2011 年 5 月 17 日

1 投票

Make sure your 32-bit and 64-bit houses are in order, as they are likely not arranged how you expect them to be. On 64-bit Windows, the 64-bit things are kept in "System32" and the 32-bit things are kept in "SysWow64". In a 32-bit command shell, what shows up as "System32" is actually "SysWow64". For example, perform the following steps:
Start a command shell (as Administrator if you have UAC on). Change into the C:\Windows\System32 directory and make a file:
echo "hello 64 bit" > hello64.txt
Now look with Windows Explorer and you will see this file where you expect it to be ... in C:\Windows\System32.
Now start the 32-bit environment by running C:\Windows\SysWow64\cmd.exe. Change directory to C:\Windows\system32 in this shell and create a similar file:
echo "hello 32 bit" > hello32.txt
Now look with the Explorer in C:\Windows\System32. You won't find the "hello32.txt" file there, but you will find it in C:\Windows\SysWow64.
So if you have things that are operating in a 32-bit environment on a 64-bit Windows host, you need to ensure that they are visible in the 32-bit environment.
So I bet if you have the other things sorted out (path, compiler settings, etc) if you put the dll's in C:\windows\syswow64 you will be able to find them.
Kaustubha Govind
Kaustubha Govind 2011 年 5 月 17 日

0 投票

It seems like you may not have all the DLLs required by the MEX-function on the path. See Solution# 1-X8A09.

3 件のコメント

Jonathan
Jonathan 2011 年 5 月 17 日
Thanks for the info, but all of the DLLs are present in C:\WINDOWS\SYSTEM32\. I believe this is the correct location for them for my application. The only thing to note is that my DLLs are compiled for 32bit windows. Should this work if the DLLs are compiled this way? It will be very difficult to change them for compiling to 64 bit DLLs.
Kaustubha Govind
Kaustubha Govind 2011 年 5 月 17 日
I expect that your configuration should work - you shouldn't have to recompile your libraries. Have you tried using Dependency Walker to make sure that you are not missing any libraries?
Gautam Vallabha
Gautam Vallabha 2011 年 5 月 19 日
"Should this work if the DLLs are compiled this way?"
Jonathan: To reiterate what Jan and Kaustubha are saying, this is not guaranteed to work. If the mex file was compiled with, say Microsoft Visual C++ 2010, then the generated DLL will require the MS Visual C++ 2010 runtime library (which is a special DLL). If you copy the mex file to a new system, then you will get an error when you try to use it if the new system doesn't have the DLL, even if the original and new systems are both 32-bit.
In the above scenario, the workaround is to download & install the appropriate runtime library (aka. "Microsoft Visual C++ 2010 Redistributable Package"). This is relatively painless and quick once you identify which runtime library you need, and DependencyWalker will tell you this information.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMATLAB Coder についてさらに検索

製品

質問済み:

2011 年 5 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by