This is going to be a bit weird but here we go.
Most programmers will have a header file specifying things for specific OS. What's in this header? Here's my example
1 2 3 4 5 6 7 8 9
#ifdef _WIN32//32 bit windows
#include <windows.h>
#endif
#ifdef _WIN64//64 bit windows
#include <windows.h>
#endif
#ifdef __gnu_linux__
#include <X11\X.h>//I forgot if that's the directory, it's been a while
#endif
Basically macros are defined within your compiler to assist you in this. Get the idea?
But this will define the functions at build time won`t it?
Don`t I need to check this at runtime?
If the 32 bit executable is running on a 32 bit Windows I need one set of methods/ structures.
And if its running as WOW64 on a 64 bit Windows version I need a different set of methods/ structures
Ah you want it at run time.Ups, it is true that the macros are only good during build time. If you want run time then your only option is IsWow64Process.
I think this answers my question actually.
Thanks for your help Factors much appreciated.
Conclusion: I need to implement two execution paths for the application.
One for 32 bit and one for WOW64, and determine the platform its running on at runtime.
A 32-bit DLL cannot be loaded into a 64-bit process (except as just a data file); nor can a 64-bit DLL be loaded into a 32-bit process. So deciding whether to load a 32-bit or 64-bit DLL at runtime is invalid.
IsWow64Process returns TRUE if you're running a 32-bit process on a 64-bit version of Windows, using WOW64. It's still a 32-bit process and can therefore only load 32-bit DLLs.
The decision on whether to load the 32-bit or 64-bit version of the DLL needs to be made at compile time.
What I mean is that sometimes you will need to use a different function or structure.
When running a 32 bit executable under WOW64. And that's when I need to know what platform I am on.