如何安装32位和64位版本的COM DLL和“自动选择”? [英] How do I install both 32-bit and 64-bit versions of a COM DLL and "auto-select"?

查看:233
本文介绍了如何安装32位和64位版本的COM DLL和“自动选择”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个DLL(一个COM服务器),将在32位和64位编译精细,但DLL使用相同的CLSID和AppID为32位版本和64位版本。这是确定还是必须更改?



我问这个问题,因为显然在64位机器上,我们不能注册32位版本64位版本在一起。如果32位客户端应用程序可以自动使用32位DLL,而64位客户端应用程序可以自动使用64位DLL,这将是很好的。



On相关的注释,我们有一个客户端应用程序的源代码和Visual Studio 2005项目文件...我们如何编译同一个应用程序的32位和64位版本?它是一个C#应用程序,它包括对我们的COM服务器DLL的引用,如下:


< ItemGroup& < COMReference Include =ComServer>



< Guid> {C1FADEA6-68FD-4F43-9FC2 -0BC451FA5D53}< / Guid>



< VersionMajor> 830< / VersionMajor> < VersionMinor> 0< / VersionMinor>



< Lcid> 0< / Lcid> < WrapperTool> tlbimp< / WrapperTool> < Isolated> False< / Isolated>



< / COMReference& < / ItemGroup>


如果事实证明我们需要一个单独的64位的CLSID,我们如何在Visual Studio中使此引用仅用于32位配置?或者我们必须具有相同源代码的单独项目:一个是指32位DLL,另一个是指64位DLL?



在32位机器上,你不能注册或者使用64位DLL,所以没有问题。



在64位机器上,64位DLL被注册在HKLM / Software / Classes / CLSID等等),并且32位DLL在HKLM / Software / Wow6432Node / Classes / CLSID中注册。 (我不知道你在哪里得到的建议,你不能在64位机器上注册32位DLL ...)在64位机器上运行的32位客户端将看起来在注册表中的正常位置,但是操作系统会将其重定向到Wow6432Node键。


We've got a DLL (a COM server) that will compile fine in 32-bit and 64-bit, but the DLL uses the same CLSID and AppID for the 32-bit version and the 64-bit version. Is this OK or does this have to change?

I'm asking this because apparently on a 64-bit machine, we can't register the 32-bit version and the 64-bit version together. It would be nice if 32-bit client applications could automatically use the 32-bit DLL, and 64-bit client applications could automatically use the 64-bit DLL.

On a related note, we have the source code and Visual Studio 2005 project file for a client application ... how do we compile a 32-bit and 64-bit version of the same application? It's a C# application, and it includes a reference to our COM server DLL like this:

<ItemGroup> <COMReference Include="ComServer">

<Guid>{C1FADEA6-68FD-4F43-9FC2-0BC451FA5D53}</Guid>

<VersionMajor>830</VersionMajor> <VersionMinor>0</VersionMinor>

<Lcid>0</Lcid> <WrapperTool>tlbimp</WrapperTool> <Isolated>False</Isolated>

</COMReference> </ItemGroup>

If it turns out that we need a separate CLSID for 64-bit, how do we make this reference "only for the 32-bit configuration" in Visual Studio? Or do we have to have separate projects with the same source code: one that refers to 32-bit DLL, and the other that refers to 64-bit DLL?

解决方案

Both versions can (and indeed should) use the same GUIDs for everything.

On a 32-bit machine you can't register or use the 64-bit DLL, so there's no problem there. The 64-bit DLL simply doesn't enter the picture.

On a 64-bit machine the 64-bit DLL gets registered in HKLM/Software/Classes/CLSID (etc.) and the 32-bit DLL gets registered in HKLM/Software/Wow6432Node/Classes/CLSID. (I wonder where you got the advice that you can't register the 32-bit DLL on a 64-bit machine...) A 32-bit client running on the 64-bit machine will look in the normal place in the registry, but the OS will silently redirect it to the Wow6432Node key instead.

这篇关于如何安装32位和64位版本的COM DLL和“自动选择”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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