在x86平台上构建x64 DLL [英] Build x64 DLL on x86 platform

查看:100
本文介绍了在x86平台上构建x64 DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试在32位计算机上为64位系统构建上下文菜单扩展dll。

输出dll文件具有正确的标头:

Hi All,
I am trying to build context menu extension dll for 64-bit system on 32-bit machine.
The output dll file has correct header:

File Type: DLL

FILE HEADER VALUES
            8664 machine (x64)





但是regsvr32说:





but regsvr32 says:

The module ContextMenuExtension.dll may not compatible with the version of Windows that you're running. Check if the module is compatible with an x86 (32-bit) or x64 (64-bit) version of regsvr32.exe.





比我使用Dependency Walker检查我的dll,发现它引用了32位版本的系统库(USER32.DLL,SHELL32.DLL,ATL100.DLL等)。

screenshot [ ^ ]



问题是:我可以配置VS2010来构建使用64位依赖项的DLL,还是只能在64位机器上构建64位DLL?



Than I check my dll using Dependency Walker and found that it referencing to 32-bit versions of system libraries (USER32.DLL, SHELL32.DLL, ATL100.DLL, e.t.c).
screenshot[^]

The question is: can I configure VS2010 to build DLL which using 64-bit dependencies or I can build 64-bit DLL only on 64-bit machine?

推荐答案

我主要在VS2008工作(需要一段时间才能改变)但在那个版本中...



编译64位时,最容易从命令行执行,编译器就在那里,但从我可以看出,没有简单的方法从IDE获取它。编译后的代码在64位工作正常,但你无法在32位环境中进行测试。



这是一篇关于从MSDN设置64位版本的文章。 br />
http://msdn.microsoft.com/ en-us / library / h2k70f3s(v = vs.100).aspx [ ^ ]



编辑:还有一件事...使用没有意义使用32位系统时64位dll上的依赖性walker。 DLL基本上是根据依赖项的名称加载的,除非64和32位版本的名称不同,你无法判断它是否真的试图加载正确的(当Windows转到64位时,它们可怕地保留了很多文件的相同名称。)
I work mostly off VS2008 (takes me a while to want to change) but in that version...

When compiling for 64bit, it's easiest to do it from the command line, the compiler is there, but from what I can tell, there's no simple way of getting to it from the IDE. The compiled code works fine in 64bit, but you can't really test it in your 32bit environment.

Here's an article on setting up for 64bit builds from MSDN.
http://msdn.microsoft.com/en-us/library/h2k70f3s(v=vs.100).aspx[^]

edit: One more thing... there's no point in using dependency walker on a 64bit dll while using a 32bit system. DLL's are mostly loaded based on the name of the dependency, unless the name of the 64 and 32bit versions is different, you can't tell if it's really trying to load the right one (when Windows went to 64bit, they horrendously kept a lot of the same names for files).


这篇关于在x86平台上构建x64 DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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