Skip to content

Instantly share code, notes, and snippets.

@m13253
Created May 2, 2024 20:37
Show Gist options
  • Save m13253/59ba58e33031ec74eb2327cb51394f7c to your computer and use it in GitHub Desktop.
Save m13253/59ba58e33031ec74eb2327cb51394f7c to your computer and use it in GitHub Desktop.
Minimal hello world
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\Llvm\bin
llvm-rc.exe helloworld.rc
clang.exe -Oz -Wall -Wextra -falign-functions=1 -falign-loops=1 -flto -fno-asynchronous-unwind-tables -fno-ident -fno-stack-protector -fno-unwind-tables -fuse-ld=lld -mwindows helloworld.c helloworld.res -o helloworld.exe -nostdlib -Wl,/SUBSYSTEM:WINDOWS,/ALIGN:16,/FILEALIGN:16 -lcomctl32 -lkernel32 -luser32
#include <windows.h>
#include <commctrl.h>
void WINAPI WinMainCRTStartup(void) {
InitCommonControls();
MessageBoxW(NULL, L"Hello world!", L"Hello World", MB_ICONINFORMATION | MB_OK);
ExitProcess(0);
}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"><assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="helloworld" type="win32"/><asmv3:application><asmv3:windowsSettings><dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware><dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness></asmv3:windowsSettings></asmv3:application><dependency><dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/></dependentAssembly></dependency></assembly>
1 24 "helloworld.exe.manifest"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment