#include <windows.h>
#include <string.h>
int mainCRTStartup(void) {
char str[] = "Hello World!";
DWORD dummy;
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), (const void*)str, strlen(str), &dummy, NULL);
ExitProcess(0);
}
In Visual Studio 2022:
> Go to Release Mode.
> Go to the properties of the project
> Go to C/C++ / Code Generation / Security Check : Disable Security Check (GS-)
> Go to C/C++ / Ouput Files / Assembler Output : Assembly; Machine Code and Source
> Go to Linker / Input / Ignore All Default Libraries : Yes (/NODEFAULTLIB)
The resulting .exe will be 3584 bytes.
zondag 23 april 2023
Small .exe for Hello World example in C
Abonneren op:
Reacties posten (Atom)
Geen opmerkingen:
Een reactie posten