c# - How can I get the processor architecture of an assembly dll? -
can processor architecture loading dll programmatically in c#?
is there class can this?
i need wether dll x86, x64, msil etc..
assuming looking @ .net assemblies, can use corflags.exe @ header of image.
this blog post explains usage determing how read results. excerpt:
usage: corflags.exe assembly [options]
if no options specified, flags given image displayed.
...
here each component of header means:
version: contains version of .net redist binary built.
clr header: 2.0 indicates .net 1.0 or .net 1.1 (everett) image while 2.5 indicates .net 2.0 (whidbey) image.
corflags: computed or’g specific flags indicate whether image ilonly, bitness etc. , used loader. ilonly: managed images allowed contain native code. “anycpu” image shall contain il.
32bit: if have image contains il still might have platform dependencies, 32bit flag used distinguish “x86” images “anycpu” images. 64-bit images distinguished fact have pe type of pe32+.
the interesting aspect pe , 32bit flag of header. these combine specify assembly types. here how for:
- anycpu: pe = pe32 , 32bit = 0
- x86: pe = pe32 , 32bit = 1
- 64-bit: pe = pe32+ , 32bit = 0
Comments
Post a Comment