none
Linking with x86 DLLs (kernel32, etc.) in 64-bit DLL?

    Question

  • Hello all,

     

    I am building a 64-bit DLL with Visual Studio 2008.  When I tried to load my DLL into a 64-bit process, the process refuses to load it properly.  I get an error saying something about dependencies not met or something related to that.  After, I decided to load up dependency walker (depends.exe) to see what the dependencies were and depends gave me an error saying that the target module architecture is different than the modules it is loading.  It shows kernel32,dll, shlwapi.dll, etc. being the x86 version.

     

    So my question is whether I need to set something specific in my 64-bit DLL project to have it link against the common x64 DLLs (CRT) such as kernel32, shlwapi, user32, etc.

     

    thanks,

    J

    Monday, November 22, 2010 6:51 AM

Answers

  • Depends.exe comes in both 32-bit and 64-bit flavors.

    You can find these in different folder if you've installed WDK.

    So use the 64-bit version of depends.exe so that it maps to the correct path to find the dependencies.

     


    «_Superman_»
    Microsoft MVP (Visual C++)
    • Marked as answer by Jon Salepor Tuesday, November 23, 2010 4:49 AM
    Monday, November 22, 2010 6:34 PM

All replies

  • You shouldn't have to set anything special in your DLL project to do that.  

    Note that on a 64-bit system, the dlls in C:\Windows\System32 ARE the 64-bit versions.  The 32-bit versions are in C:\Windows\SysWOW64 .  

    (This is possibly confusing, but it kind of makes sense if you accept the logic that System32 always contains the native versions of the dlls and exes.)


    Answering policy: see profile.
    Monday, November 22, 2010 1:07 PM
  • Depends.exe comes in both 32-bit and 64-bit flavors.

    You can find these in different folder if you've installed WDK.

    So use the 64-bit version of depends.exe so that it maps to the correct path to find the dependencies.

     


    «_Superman_»
    Microsoft MVP (Visual C++)
    • Marked as answer by Jon Salepor Tuesday, November 23, 2010 4:49 AM
    Monday, November 22, 2010 6:34 PM