Apologies if any of what I'm about to say makes no sense or overlooks something obvious - my knowledge of CLR internals is spotty.
If I understand correctly, then if I just build a solution for 'AnyCPU' in VS2K5 (or point MSBuild at that .sln file with those settings) then the binaries only compile as far as MSIL. They then get JITted to 32-bit if executed on a 32-bit platform or 64-bit code if executed on x64...right?
The DLLs are used for a web app and hosted in the W3WP.exe process. Process Explorer tells me W3WP is a 64-bit process.
But when I use Process Explorer to check the properties on one of these DLLs in DLL view, it says: 'Image: 32-bit'. What gives?
If I run corflags against the dll in question it tells me: ILONLY 1 , 32BIT 0 but PE PE32 . My understanding is that this means yes it is compiled only as far as IL, no it's not limited to either 32 bit or 64 bit, but I'm not entirely clear. Is the PE32 flag anything to do with it showing up as 32-bit as per above?
Your question is related to this question. What you are seeing in process explorer is the type of image, which is different of the "runtime compatibility" type specified in the assembly's corflags.
The point of setting "Any Cpu" is to force the most common denominator in both the native image and the assembly, so that it lets the windows bootstrapper for .NET choose what kind of Runtime will be the most appropriate for the current platform.
So, for your example, you do have a 32 Bits image (as specified by the PE Header), containing an "Any CPU" assembly (as specified by the CorFlags for the assembly).
They then get JITted to 32-bit if executed on a 32-bit platform or 64-bit code if executed on x64...right?
Right, you can check by executing the same exe compiled for AnyCPU :
sizeof(IntPtr) == 4 //true on 32bit
sizeof(IntPtr) == 8 //true on 64bit
But, if your assembly is referenced in a process compiled for 32-bit platform only, it'll be jited to 32bit (run in WOW for 64-bit Windows).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With