GNU GNU compiler suite without external dependencies

Are there free Windows-compatible packages for Windows that generate standalone executable files without external dependencies?

Here are some of them that do not meet the requirements, ordered by objectionability, the least for most:

Right now I'm leaning (and using, albeit uncertainly) MinGW, as this seems to be the most “clean” approach. I am still not happy with MSVCRT.DLL dependency, especially because I can and should deal with clients working under pre-Win2K. (Windows 2000 was the first release shipped with MSVCRT.DLL) Distributing MSVCRT with an application is not an option.

PS: I know that there is an attempt to create an MSVCRT replacement for MinGW, but it is still unstable / beta and has limited functionality; not something that I would feel comfortable using for production applications.

PPS: Responses to the effect “MSCVRT is usually anyway” or “Just repack the list” are not constructive answers. The question, in particular, is how to AVOID dependencies, rather than ensure their availability.

+8
source share
1 answer

To avoid MSVCRT with MinGW, use the following flags for the linker:

-nostdlib -Wl,--exclude-libs,msvcrt.a -Wl,-eWinMain 

Note that you must declare a function named WinMain (you can also choose a different name for it), which will be your main . You also cannot use any standard functions like strlen , printf and friends. Instead, you should use WinAPI equivalents such as lstrcmp , wsprintf , etc.

You can see an example of this using SCons at:

https://sourceforge.net/p/nsis/code/6160/tree/NSIS/trunk/SCons/Config/gnu

I used this for my project, which also requires compatibility with Windows 9x. It also has a nice side effect of having smaller executables. Judging by your comments above, it seems you are looking for this too. If so, you can use even more tricks in the file to which I refer above.

Microsoft has a table corresponding to the CRT and WinAPI functions in the following KB99456:

Win32 Equivalents for C Runtime Functions ( Web Archive )

More info on how to get rid of CRT (although for VC, this can still help) at:

http://www.catch22.net/tuts/win32/reducing-executable-size

+11
source

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


All Articles