0
到目前爲止,我已經能夠使用下面的代碼加載DLL:如何以編程方式檢測DLL是在.NET中編譯爲32位還是64位?
Assembly^ assembly = Assembly::LoadFrom(pathDll);
但我不知道如何檢測它是否是32位或64位。
到目前爲止,我已經能夠使用下面的代碼加載DLL:如何以編程方式檢測DLL是在.NET中編譯爲32位還是64位?
Assembly^ assembly = Assembly::LoadFrom(pathDll);
但我不知道如何檢測它是否是32位或64位。
我認爲我找到了答案。關當然,首先你必須獲得與DLL相關的組件,雖然下面的代碼行:
ProcessorArchitecture processor_architecture = assembly->GetName()->ProcessorArchitecture;
if (ProcessorArchitecture::Amd64 == processor_architecture)
{
// 64bits
}
if (ProcessorArchitecture::X86 == processor_architecture)
{
//32 bits
}
可能:
那麼你可以通過下面的代碼獲得有關該平臺的信息[我如何測試Windows DLL以確定它是32位還是64位?](http://stackoverflow.com/questions/495244/how-can-i-test-a-windows-dll-to-determine -if-it-is-32bit-or-64bit) – t0mm13b
你可以使用dumpbin utli語法:dumpbin/headers –