Showing posts with label Zig. Show all posts
Showing posts with label Zig. Show all posts

Sunday, March 23, 2025

Demo how to use zigwin32 in your zig application

Demo how to use zigwin32 in your zig application

Create a Zig application, like:
PS C:\prj\zigwin32test> zig init
Modify build.zig to add zigwin32. See lines 68-72 in gist below. Update src/main.c to look like below. Checkout zigwin32 into the root of the project
PS C:\prj\zigwin32test> git clone https://github.com/marlersoft/zigwin32 libs/zigwin32
Now do a build:
PS C:\prj\zigwin32test> zig build run
Reference:
https://github.com/myZig/zigwin32test

Compiling helloworld.c C application using Zig

Compiling helloworld.c C application using Zig

Zig can be used to compile C source code. Below shows a very simple C source code, helloworld.c. Copy and save this to a file, say, in C:\hello-c\helloworld.c
To compile using Zig, do:
PS C:\hello-c> zig cc .\helloworld.c -o helloworld.exe

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. 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

Monday, May 13, 2024

How to call ReadConsoleInputW using Zig in Windows

How to call ReadConsoleInputW using Zig in Windows

ReadConsoleInputW can be used to mimic kbhit() C function found in Borland C/C++.
OS: Windows 10 22H2
Zig: 0.12
Compile ReadConsoleInputW.zig:
PS C:\prj> zig build-exe -lc .\ReadConsoleInputW.zig

Thursday, May 02, 2024

How to call MessageBoxW using Zig in Windows

How to call MessageBoxW using Zig in Windows

OS: Windows 10 22H2
Zig: 0.12
Compile messageboxw.zig:
PS C:\prj> zig build-exe -lc .\msgboxw.zig

How to call MessageBoxA using Zig in Windows

How to call MessageBoxA using Zig in Windows

OS: Windows 10 22H2
Zig: 0.12
Compile messagebox.zig:
PS C:\prj> zig build-exe messagebox.zig -lc

Tuesday, April 30, 2024

Zig - hello world

Hello world in Zig

PS C:\prj> mkdir hello-world
PS C:\prj> cd .\hello-world\
PS C:\prj\hello-world> zig init
You should see this output during init
info: created build.zig
info: created build.zig.zon
info: created src\main.zig
info: created src\root.zig
info: see `zig build --help` for a menu of options
Run it like this
PS C:\prj\hello-world> zig build run
The output should look like this
steps [4/7] install... All your codebase are belong to us.
Run `zig build test` to run the tests.

Fedora install screen chronicle

Fedora install screen chronicle Below are links to Fedora installation screens. It is interesting to see how it has evolved over time. Fe...