user489842
user489842

Reputation: 1

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 32bit and 64bit.

Thanks, kam

Upvotes: 0

Views: 437

Answers (3)

gtikok
gtikok

Reputation: 1159

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

Upvotes: 0

frast
frast

Reputation: 2740

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.

Upvotes: 1

sharptooth
sharptooth

Reputation: 170489

On Windows you use IsWow64Process() function.

Upvotes: 2

Related Questions