zhtet
asked on
C++ check bitness of OS
Hi, I am wondering if there is a way to determine the bitness (can safely assume it's either 32bit or 64bit) of the OS from a C++ 32bit program. Tried sizeof and limits but they are all defined to be 32bit for INT's, either cause it's a 32bit program, or visual C++'s LLP64 architecture is restricting it, whichever.
Thanks
Thanks
ASKER
to give a better context, i have to load the msado dll, and the program is 32 bit, but i will be compiling it on both 32 and 64 bit machines... i.e. it will be
#import "C:\Program files\Common Files\System\Ado\msado15.d ll" rename("EOF", "ADOEOF") or
#import "C:\Program Files (x86)\Common Files\System\Ado\msado15.d ll"
depending on the OS...
hope that clears it up..
#import "C:\Program files\Common Files\System\Ado\msado15.d
#import "C:\Program Files (x86)\Common Files\System\Ado\msado15.d
depending on the OS...
hope that clears it up..
you can evaluate the sizeof any pointer:
int bits = sizeof(void *) * 8;
notice even if you are running a 64-bit OS, your application not always use 64-bit pointers, it could still have 32-bit pointers.
int bits = sizeof(void *) * 8;
notice even if you are running a 64-bit OS, your application not always use 64-bit pointers, it could still have 32-bit pointers.
ASKER
yea i stated above, my application is 32 bit, so it still using 32 bit ptr's though the OS is 64 bit... i need to find out the OS bitness... since it could very well be a 32 bit machine i am compiling on...
you can use GetSystemInfo() and GetNativeSystemInfo() functions.
ASKER
but aren't these as well as IsWow64Process all run-time functions? since i am importing a dll to be included during compile time, i would need to know this fact during compile time. or am i mistaken?
Thanks
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER