I want to compile C code like it is 32-bit app (so sizeof(void*) would be 4), but run it inside 64-bit app.
I can guarantee this code will not receive pointers to >4 GB address space, etc.
I just need a toolchain to do so.
I want to compile C code like it is 32-bit app (so sizeof(void*) would be 4), but run it inside 64-bit app.
I can guarantee this code will not receive pointers to >4 GB address space, etc.
I just need a toolchain to do so.
There is an x32 memory model available for Linux, which is 64-bit code with 32-bit pointers. This seems more suitable for "don't break code that stores pointers in unsigned int, please!" usage. But the whole application should be built using that target.
However combining x32 and x86_64 code in the same process is much less difficult than x86 and x86_64, since it doesn't require the CPU to switch modes.
How can I compile C code as 32 bit code and run in in 64-bit app??
On both Windows and Linux, you cannot execute 32 bit code in a 64 bit process. Or indeed vice versa.