Portability on all windows platform both 32 and 64 bit

84 views Asked by At

What should i care about when it comes to portability an all windows platform both 32 and 64 bit? More over,if there's the necessity of using the windows APIs,what good habit should i have?

1

There are 1 answers

0
inovasyon On

Don't know C++ but there is a simple and straight solution. Put both 32 and 64 bit builds in a directory. And also place this bat file in there.

IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" GOTO x64
IF "%PROCESSOR_ARCHITEW6432%"=="AMD64" GOTO x64
IF "%PROCESSOR_ARCHITECTURE%"=="x86" GOTO x86
:x86
START "" build32.exe %1
GOTO arcselend
:x64
START "" build64.exe %1
:arcselend
exit

Even if you want to do after execution actions (after program exits) also welcomes

IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" GOTO x64
IF "%PROCESSOR_ARCHITEW6432%"=="AMD64" GOTO x64
IF "%PROCESSOR_ARCHITECTURE%"=="x86" GOTO x86
:x86
START "" /W build32.exe %1
GOTO arcselend
:x64
START "" /W build64.exe %1
:arcselend

:: Do something here like
DEL /F/Q "-PATH-\sometempfile.tmp" >NUL 2>NUL

exit

You don't want bat files around? Here we have a bat 2 exe compiler with an extremely small footprint. In the settings you can define to start your app with elevated privileges also.

Note: Use relative path (sure) and if you have any problem about paths write here. There will be another simple solution.