7 ms·
I was looking at the C Runtime Library the other day and found the following series of article on how to remove msvcrt.lib: https://hero.handmade.network/forum
by chris_wot 11y ago
I was looking at the C Runtime Library the other day and found the following series of article on how to remove msvcrt.lib:
https://hero.handmade.network/forums/code-discussion/t/94 https://hero.handmade.network/forums/code-discussion/t/94
Basically, the entrypoint for Win32 isn't actually WinMain, but WinMainCRTStartup. To replace it you need to reimplement a few things, including an implementation of memcpy() and memset(), some allocation routines for 32 bit code under 64 bit systems and some floating point routines.
Curious to know what the new universal runtime loads up. I'd love Microsoft to be a bit more open about what their C runtime actually does before a program linked to it loads. Of course, perhaps they are, and I've missed it.
Edit: looks like someone was pissed about this lack of documentation in the beta Vususl Studio beta:
http://levicki.net/articles/2015/12/03/RANT_Microsoft_Visual_Studio_2015.php http://levicki.net/articles/2015/12/03/RANT_Microsoft_Visual...
- asveikau 11y ago> I'd love Microsoft to be a bit more open about what their C runtime actually does before a program linked to it loads. Of course, perhaps they are, and I've missed it. The source code to the CRT ships with Visual Studio. > Basically, the entrypoint for Win32 isn't actually WinMain, but WinMainCRTStartup. The entry point is whatever appears in the PE header and you can name it whatever you want. It just so happens that the default linker settings point it at CRT, which calls into you. You can change this with linker settings.
- chris_wot 11y agoYa, I didn't explain that as well as I might have. That is correct :-)