Sunday, March 23, 2025

Compiling hello win32 C application in Zig

Compiling hello win32 C application in Zig

This is very similar to compiling C source in Zig but this time using win32 API.
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL, "Hello, Windows!", "Hello, Windows!", MB_OK);
return 0;
}
view raw hell-win32.c hosted with ❤ by GitHub
Copy and save this to a file, say, in C:\prj\hello-win\hello-win32.c
To compile using Zig, do:
PS C:\prj\hello-win> zig cc .\hello-win32.c -o hello-win32.exe

No comments:

How to configure nfs server on QNX 7.1

How to configure nfs server on QNX 7.1 Target: QNX 7.1 running on a VM (VMware Workstation or VirtualBox). It is assummed that the targets ...