Problems with the failure of C # to invoke a dynamic library DLL for 32-bit and 64-bit deployments

Source: Internet
Author: User
Tags mixed

        because dynamic libraries are called in the project, these dynamic libraries are placed under C:\Windows\System32, but they may be problematic when deployed to a 64-bit machine. Recently this problem has been entangled for a long time, in this machine 32 for the system test dynamic call DDL succeeded, deployed to the 64-bit window Server2008 is not a problem, but why the 64-bit WIN7 system on the problem.
        finally found that the original DLL is not the right location, then the DLL should be put there.
         If you are careful, you will find two folders under the C:\Windows\ directory: The system directory and the System32 directory, In fact, the system directory is a legacy of Windows 3.x, which is used to keep Windows backward to some of the older applications. Generally, 16-bit DLL files (and other supporting files) are stored in the \Windows\System folder, and 32-bit DLL files and different support files are stored in the \Windows\System32 folder. The way the
       32-bit version of Windows keeps 16-bit and 32-bit DLL files is very simple,  . However, the 64-bit version of Windows keeps the 64-bit and 32-bit DLL files in a less straightforward way.

In theory, Microsoft will create a folder called \windows\system64 to use it to store 64-bit DLL files, but instead, Microsoft has created a new folder named SysWOW64 to hold 32-bit DLL files. At first glance, it feels like this folder should hold 64-bit applications, but note that 32-bit applications should have stored their DLL files in the \Windows\System32 folder. The Windows\System32 folder still exists within the 64-bit version of Windows. But Microsoft uses this folder as a warehouse for 64-bit DLLs, not as a 32-bit DLL file. I'm not sure why Microsoft made the Windows\System32 folder to store 64-bit DLLs, but I heard it was for backward compatibility.
When you install a 32-bit application, the installation Wizard runs through WOW64 Emulato. 32-bit and 64-bit code are not mixed. Once an application (including an installation wizard) starts running from WOW64 emulator, it must continue to run within WOW64. This means that when you install an application, the installation Wizard does not know that the program is installed in the 64-bit version of Windows and writes the DLL file to the \Windows\System32 folder as it runs on the 32-bit operating system.

Of course, WOW64 knows the 32-bit application that the installation Wizard runs through emulator. Also know that 64 and 32-bit code cannot be mixed together. So, WOW64 emulator creates an alias for \windows\syswow64. This means that any time a 32-bit application is written to the \Windows\System32 folder or read from the \windows\syswow64 folder, WOW64 emulator can redirect it to the \windows\syswow64 folder.

Finally, the dynamic library is dropped into the C:\Windows\SysWOW64 directory, OK


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.