Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does MSVC 2010 32bit project link to 64bit kernel32.dll?

I have a Win32 (32bit) DLL project which builds and links without error. The DLL fails to load into a 32bit process. Using DependencyWalker, I see that the DLL is 32bit but has been linked with 64bit libraries for kernel32, msvcr100d, ws2_32 and msvcr100.

DependencyWalker also shows an error

Error: Modules with different CPU types were found.

I've puzzled over this problems for a couple of hours now, and just can't fathom it - has anyone else experienced this, and found a solution?

like image 409
cdmh Avatar asked May 23 '11 21:05

cdmh


1 Answers

Short Answer: Use Dependency Walker for x86 for x86 stuff.

Long Answer: Initially I used Dependency Walker for x64 on the MS Windows 7 OS and ran into the hurdles you did. I then followed MerickOWA's advice about changing the search paths (thanks MerickOWA). Though I still had a handful of dependencies causing "Error: Modules with different CPU types were found".

Instead of figuring out how to configure Dependency Walker to search for the x86 DLLs in bizarre looking paths like "c:\windows\winsxs\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.17514_none_2b24536c71ed437a\GDIPLUS.DLL" correctly, I used the Dependency Walker for x86. Worked like a charm for me!

like image 161
Andrew Smart Avatar answered Nov 16 '22 03:11

Andrew Smart