Compilation for x86 and x64

Is it possible to configure the compiler so that it compiles the executable / DLL for x86 and x64? I mean one file suitable for both platforms.

I only know a way to select platforms separately, but I want both.

Is it possible?

+6
source share
1 answer

The x86 executable is fully supported on the x64 host. For instance. any EXE that you compile in 32-bit mode will work without problems on a 32-bit and 64-bit host. If you don’t know why a 64-bit executable is needed, you probably won’t do it, so a 32-bit executable is enough.

However, the DLL is another matter. The architecture of the DLL (32-bit or 64-bit) must correspond to the executable file in which the DLL will be used. For instance. if you write a Windows Explorer extension for Windows x64, explorer.exe will be 64-bit, so your DLL must also be 64-bit, otherwise it cannot be loaded.

It is not possible to combine two different architectures into one DLL or EXE on Windows. Thus, you will need two DLLs if you need to support both 32-bit and 64-bit hosts.

+19
source

Source: https://habr.com/ru/post/898840/


All Articles