如何在64位计算机配置中使用32位DLL. [英] How to use 32 bit DLL in 64 bit machine configuration.

查看:98
本文介绍了如何在64位计算机配置中使用32位DLL.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的开发人员,
我有32位DLL,我想在64位计算机上使用.

请帮助或指导我.

在此先感谢.

问候,
Ravi Sharma

Dear Developer,
I Have 32 bit DLL, that i want to use in 64 bit machine.

Please help or guide me.

Thanks in Advance.

Regards,
Ravi Sharma

推荐答案

所有64位平台(有两种Intel指令集架构IA-64(Itanium)和x86-64,请参见http://en.wikipedia.org/wiki/Itanium [ http://en. wikipedia.org/wiki/X86-64 [ ^ ])在WoW64平台上工作,请参见 http://en.wikipedia.org/wiki/WoW64 [ ^ ].

所有这三种指令集Intel体系结构都不兼容,但是32个应用程序与这两种64位指令集Intel体系结构都兼容.问题是:具有不同目标体系结构的可执行模块不能在同一过程中使用.相互之间使用此类项目的解决方案将内置到程序集中,但它们在运行时会崩溃.

现在,微妙的方面是目标平台任何CPU".由于.NET代码是JIT编译的,因此此类可执行模块将在运行时由于其加载的物理体系结构而进行JIT编译.如果所有项目均已编译为任何CPU".如果不是,则实际运行时间将由应用程序的输入程序集定义.如有冲突,请参见上文.

另一个问题是P/Invoke,它可以将.NET程序集绑定到特定的指令集体系结构,或者恰恰相反,当您需要32位版本时,将其移植到64位平台后,可以将.NET程序集链接到其他体系结构,这仅仅是因为DLL相同名称下的是64位.这样的问题更难以发现. Microsoft Dependency Walker是一个很好的帮助工具,请参见 http://en.wikipedia.org/wiki/Dependency_Walker [ ^ ],^ ].您确实需要了解非托管代码中的所有依赖项.

—SA
All 64-bit platforms (there are two Intel instruction-set architectures, IA-64 (Itanium) and x86-64, see http://en.wikipedia.org/wiki/Itanium[^], http://en.wikipedia.org/wiki/X86-64[^]) work on the platform of WoW64, see http://en.wikipedia.org/wiki/WoW64[^].

All three instruction-set Intel architectures are incompatible, but a 32-application is compatible with both 64-bit instruction-set Intel architectures. The problem is: executable modules with different target architectures cannot be used in the same process. The solution with such projects using each other will build into assemblies, but they will crash during run-time.

Now, the delicate aspect is the target platform "Any CPU". As .NET code is JIT-compiled, such executable modules will be JIT-compiled during run-time due to the physical architecture they are loaded on. This is if all the projects were compiled "Any CPU". If not, the actual run-time will be defined by the entry assembly of the application. In case of conflict — see above.

Another problem is P/Invoke which can tie .NET assembly to a certain instruction-set architecture or, just the opposite, link it to a different architecture after moving to 64-bit platform while you require 32-bit version, simply because the DLL under the same names comes in 64-bits. Such problems are more difficult to detect. One good tool to help is Microsoft Dependency Walker, see http://en.wikipedia.org/wiki/Dependency_Walker[^], http://www.dependencywalker.com/[^]. You really need to know all your dependencies in unmanaged codes.

—SA


如果您的dll是本机32位dll,则可以将其包装为COM服务器.

埃德·斯特拉斯伯格(Ed Strassberger)有一个非常巧妙的示例,说明如何从64位客户端调用32位COM出进程服务器-他在此发布中回答了自己的问题:
对32位COM/ATL的64位客户端调用服务器EXE失败 [ ^ ]

最好的问候
Espen Harlinn
If your dll is a native 32-bit dll - you could wrap it as a COM server.

Ed Strassberger has a very neat example on how call a 32-bit COM out of process server from a 64-bit client - he answers his own question in this posting:
64-bit client call to 32-bit COM/ATL server EXE fails[^]

Best regards
Espen Harlinn


希望
Hope this[^] might help you.

IIRC a reboot is required for it to take effect.

Have you done it.


这篇关于如何在64位计算机配置中使用32位DLL.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆