我想建立一个DLL类库使用COM互操作,用C#,针对任何CPU,并将其注册为32位和64位接口。
I want to build a DLL Class Library use COM Interop, with C#, target ANY CPU, and register it as 32-bit and 64-bit interfaces.
我希望能够在运行时,显示的内容界面使用 - 如果我现在用的是32位版本或64位版本的
I want to be able to, at runtime, display what interface was used - if I am using the 32-bit version, or 64-bit version.
任何想法?
为了让一个进程加载32位的DLL,该过程必须是32位。而同样为64位。因此,要找出已经被加载,假设它已经工作,你只需要找出位岬的CLR的:
In order for a process to load a 32-bit DLL, the process has to be 32-bit. And same for 64-bit. So to find out what has been loaded, assuming it has already worked, you just need to find out the bit-ness of the CLR:
if (System.IntPtr.Size == 8)
{
// 64-bit
}
else
{
// 32-bit
}
PS。对于是否需要检查16的大小讨论,请参阅my这个问题的答案。
上一篇:drawInRect:glkView的区别和glkViewControllerUpdate:? OpenGL ES的2 - 的iOS区别、glkView、drawInRect、glkViewCont