Skip to content

Instantly share code, notes, and snippets.

Created September 26, 2016 09:30
What would you like to do?
Freestanding MinGW
// Freestanding with MinGW:
#include <windows.h>
int WINAPI mainCRTStartup(void)
char msg[] = "Hello, world!\n";
HANDLE stdout = GetStdHandle(STD_OUTPUT_HANDLE);
WriteFile(stdout, msg, sizeof(msg), (DWORD[]){0}, NULL);
return 0;
gcc -nostdlib -ffreestanding -mconsole -O2 -fno-stack-check -fno-stack-protector -mno-stack-arg-probe -o freestanding_hello.exe freestanding_hello.c -lkernel32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment