64 bit DLLs in Windows
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: 64 bit DLLs in Windows

  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,235

    64 bit DLLs in Windows

    I'm sure this might seem like a dumb question one way or the other - but if I build a 32-bit app which somebody uses on Win64, can it use a 64-bit version of a third party DLL or does the whole chain need to be 32-bit? I'm assuming I can't mix & match because presumably, the app and all its dependencies would need to run in a 32-bit VM. Is that the case?

    And what about the other way around? Can a 64-bit app use a 32-bit third party DLL or does the whole chain need to be 64-bit??
    "A problem well stated is a problem half solved. - Charles F. Kettering

  2. #2
    Join Date
    Apr 1999
    Posts
    27,423

    Re: 64 bit DLLs in Windows

    Quote Originally Posted by John E View Post
    I'm sure this might seem like a dumb question one way or the other - but if I build a 32-bit app which somebody uses on Win64, can it use a 64-bit version of a third party DLL
    No.

    It is easy to test:
    Code:
    #include <windows>
    
    int main()
    {
         HMODULE hMod = LoadLibrary( "MyDLL" );
         if ( hMod )
        {
               // Loaded successfully
              FreeLibrary( hMod );
        }
        else
        {
            // Didn't load successfully
        }
    }
    Assume this is a 32-bit application and MyDLL is a 64-bit DLL. What will happen (assuming that MyDLL would have loaded OK if the app was also 64-bit instead of 32-bit)?

    Then make the same test vice-versa -- the app is 64-bit and the DLL is 32-bit.
    And what about the other way around? Can a 64-bit app use a 32-bit third party DLL
    No. The closest you can do is to launch a 32-bit process that uses the 32-bit DLL and then utilize some sort of IPC to communicate the results/data/whatever back to the 64-bit app.

    Regards,

    Paul McKenzie

  3. #3
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,235

    Re: 64 bit DLLs in Windows

    Thanks Paul. That's pretty much what I thought.
    "A problem well stated is a problem half solved. - Charles F. Kettering

  4. #4
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,235

    Re: 64 bit DLLs in Windows

    Having looked into this a bit further I've noticed that it's becoming common on Linux for libraries to be distributed in "mixed 32/64" packages. From what I can gather, each module (lib / so) contains functions compiled both in 32-bit form and also 64 bit - so the same physical module can be used with either a 32-bit version of the app or a 64-bit version. I can (kinda) see the advantage of that but I'm guessing we can't do that with VC++?
    "A problem well stated is a problem half solved. - Charles F. Kettering

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center