I don't mean "portable" in a way that you can re-compile the source code under Linux or whatever, but rather a Windows-only application that does not require installation, so you just put the .exe and some dll-s in a folder and copy it to another machine and it works.
It didn't require any effort at all with VS 2003 and earlier, but with 2008 putting the missing dll-s into same folder doesn't work, it requires installing re-distributables. I remember hearing that the p开发者_JAVA百科roblem can be solved with manifests, which I have never encountered before.
So, how can I do that?
Link with static libraries for CRT, MFC, and anything else you use. Make sure you don't use Win32 APIs that were introduced in Vista or Win7 (i.e., keep WIN32_WINNT <= 0x501). Use Dependency Walker to ensure that your executable only imports kernel32, user32, gdi32, or other things that are guaranteed to be in a default windows install.
What about statically linking the c runtime? Your resulting executable will be bigger though.
Also look at the backward binary compatibility reports for all interested versions of Windows: https://abi-laboratory.pro/index.php?view=windows
And check if your binaries/dlls import any of the removed/changed symbols.
The reports have been generated by the abi-compliance-checker tool.
精彩评论