简体   繁体   English

将C ++ / CLI构建为x86不会产生x86输出dll?

[英]Building C++/CLI as x86 doesn't produce x86 output dll?

I am using Visual Studio 2012 in a Windows 7 machine. 我在Windows 7计算机中使用Visual Studio 2012。 I7 processor. I7处理器。

I have a Managed C++/CLI library. 我有一个托管的C ++ / CLI库。 The project also references a Native C++ static library. 该项目还引用了Native C ++静态库。 I have everything configured for x86. 我已经为x86配置了所有东西。

However when I build, if I check the resulting dll with CorFlags it says: 但是,在构建时,如果我用CorFlags检查生成的dll,它会说:

PE: PE32 PE:PE32

CorFlags: 24 CorFlags:24

ILONLY: 0 ILONLY:0

32BIT: 0 32位:0

Signed: 1 签名:1

According to this post it means that my dll is for AnyCPU? 根据这篇文章,这意味着我的dll是否适用于AnyCPU? I tried to find more documentation on how to interpret the flags, but I didn't find anything different. 我试图找到更多有关如何解释标志的文档,但没有发现任何不同之处。

I am confused, If I built with the Platform configured to "x86", shouldn't the 32Bit flag be 1? 我很困惑,如果我将平台配置为“ x86”,则32Bit标志不应该为1吗?

Am I missing some additional configuration? 我是否缺少其他配置?

It is a bit of a quirk for mixed-mode assemblies. 对于混合模式装配体,这有点古怪。 The ILONLY flag is dominant here. ILONLY标志在这里占主导地位。 With it set to 0, it tells the CLR that the assembly contains more than MSIL, it also contains machine code. 将其设置为0时,它告诉CLR程序集包含的内容超过了MSIL,还包含了机器代码。 That blows the relevance of the 32BIT option, the assembly can only ever work if the bitness of the process agrees with the bitness of the machine code in the file. 这打击了32BIT选项的相关性,仅当进程的位数与文件中机器代码的位数一致时,汇编程序才能正常工作。

Which is set by the executable header, IMAGE_FILE_HEADER.Machine determines that. 由可执行标头IMAGE_FILE_HEADER设置。 Like it does for any executable file that contains machine code. 就像对包含机器代码的任何可执行文件一样。 Corflags doesn't display it, you can see it with dumpbin.exe /headers Corflags不会显示它,您可以使用dumpbin.exe / headers看到它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM