![]() Additional Dependencies tells the linker to use my small libc. Ignore Default Libraries is to ignore the default libc. I had to disable the Buffer Security Check in order to use my own libc (and, of course, disabling it reduces size anyway). The Struct Member Alignment is easy to understand. ![]() What's to say is that I disabled the Whole Program Optimization because it didn't allow me to use my own libc. Minimize Size and Favor Small Code are quite easy to understand. I used Pietrek's entries, since they were already working, no need to write new ones. In the case of the Win32 EXE and the console program, the actual entry point has to get the command line through GetCommandLine and parse it. The other functions I had to write by myself.Ī lot of string functions are just wrappers to Windows APIs.Įxtern " C" int WINAPI wWinMainCRTStartup( void)Įxtern " C" int WINAPI WinMainCRTStartup( void)Įxtern " C" BOOL WINAPI _DllMainCRTStartup(HINSTANCE hInstance,Įxtern " C" int WINAPI wmainCRTStartup( void)Įxtern " C" void _cdecl mainCRTStartup( void) I believe I took splitpath from wine (I don't remember for sure) and strol / strtoul from somewhere on the web. I just put some stdio functions in my libc to make small console projects work.īasically, I took half of the string functions from Microsoft's SDK. Unicode Secure: wcscpy_s wcsncpy_s wcscat_s wcsncat_s _wsplitpath_sįor best optimization, it's not advisable to use functions like scanf.Unicode: wcslen wcscpy wcsncpy wcscat wcsncat wcscmp wcsncmp _wcsicmp wcsupr wcslwr wcschr wcsstr wcstol wcstuol _wsplitpath.ANSI Secure: strcpy_s strncpy_s strcat_s strncat_s _splitpath_s.ANSI: strlen strcpy strncpy strcat strncat strcmp strncmp _stricmp strupr strlwr strchr strstr strtol strtoul _splitpath.memset memcpy memmove memcmp memchr memcpy_s.I won't post the code of the libc, since it's useless. As you can imagine, this article is not to be taken too seriously. So, I decided to add some functions to my small libc and create a wizard to make the whole task as easy as possible. When I was done with that job, I didn't want to leave the files getting old on my hard drive. So, basically, I wrote my own small libc including support for Unicode, secure functions, 圆4, and Itanium. I never really cared about the size of executables produced by Visual Studio, until I had to build some small ones for work. Let's consider this article an update to Matt Pietrek's one about his tiny libc. If you're interested in knowing more details about this little project, just keep reading. If you just want to start using this wizard, install it and click on Small Application in the Visual Studio's New Project window. The downloadable installer was designed for Visual C++ 8, I haven't tested it on earlier versions. It helps you build small executables with just a few clicks. This is a Small Application Wizard for Visual Studio. Download installer and sources - 299 Kb.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |