开发者

load dlls at runtime for 32 bit and 64 bit

I need to load dlls at runtime for 32 bit and 64 bit. how do i determine 3开发者_开发知识库2bit and 64bit.

Thanks, kam


On Windows you use IsWow64Process() function.


Typically this is done at build time. You produce 32-bit binaries which load 32-bit DLLs and 64-bit binaries which load 64-bit DLLs.

The user then uses the setup for her platform (32-bit installer or 64-bit installer).

So there is no need to find out at runtime on which platform you are for this.

It is not possible to load 32-bit DLLs in an 64-bit Application or the other way around.


For Windows you can use following function.

#include<Windows.h>
BOOL IsX86()
{
    char proc[9];

    GetEnvironmentVariable("PROCESSOR_ARCHITEW6432", proc, 9);

    if (lstrcmpi(proc, "AMD64") == 0)
    {
        return FALSE;
    }

    return TRUE;
}

At least it works for me.

For details please see the link:

Link

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜