About 32-bit and 64-bit deployments with C # calling Delphi Dynamic Library DLL unsuccessful issues

Source: Internet
Author: User

Because of the dynamic library called in the project, these dynamic libraries are placed under C:\WINDOWS\SYSTEM32, but when deployed to a 64-bit machine may be problematic, recently this problem has been tangled for a long time, in the native 32 for the system test dynamic call DDL successfully, deployed to 64-bit window Server2008 above also no problem, but why to the 64-bit WIN7 system has a problem?
Finally found that the original DLL location is not correct, then the DLL should put it?
If you are careful, you will find that there are 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, to keep Windows backward compatible with 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 supporting files are stored in the \Windows\System32 folder.
The 32-bit version of Windows keeps 16-bit and 32-bit DLL files in a very simple way, but the 64-bit version of Windows maintains 64-bit and 32-bit DLL files in a way that is not so simple.

In theory, Microsoft is going to create a folder called \windows\system64 to hold 64-bit DLL files, but instead, Microsoft created a new folder called SysWOW64 to hold 32-bit DLL files. At first glance, it makes sense that this folder should contain 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 repository for 64-bit DLLs instead of 32-bit DLL files. I don't know why Microsoft made the Windows\System32 folder to hold 64-bit DLLs, but I heard it was for backwards compatibility.
When you install a 32-bit application, the Setup Wizard runs through WOW64 Emulato. The 32-bit and 64-bit codes are not mixed. Once an application (including an installation wizard) starts running from WOW64 emulator, it must then continue to run within WOW64. This means that when you install an application, the Setup Wizard does not know that the program is installed in the 64-bit version of Windows and writes the DLL files to the \Windows\System32 folder as if it were running on a 32-bit operating system.

Of course, WOW64 knows the 32-bit applications 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 drop the dynamic library into the C:\Windows\SysWOW64 directory and it's OK.

Reprint http://blog.csdn.net/huangxiangec/article/details/8563974

About 32-bit and 64-bit deployments with C # calling Delphi Dynamic Library DLL unsuccessful issues

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.