Zig examples ⬆
Directory examples\ contains Zig code examples coming from various websites - mostly from the Zig project.
|
This project has the following directory structure :
> tree /f /a . | findstr /v /b [A-Z] | build.bat | build.sh | build.zig | Makefile \---src \---main \---zig hello.zig
Command zig
build
reads the project file build.zig
to generate the Zig program zig-out\bin\hello.exe
:
> zig build & zig-out\bin\hello.exe Hello, world!
Command build.bat
-verbose run
generates and runs executable target\hello.exe
:
> build -verbose run Compile 1 Zig source file to directory "target" Execute Zig program "target\hello.exe" Hello, world!
> make run "C:/opt/zig-0.13.0/zig.exe" build-exe -femit-bin="target/hello.exe" src/main/zig/hello.zig target/hello.exe Hello, world!
Note: We can display internal information of the generated executable
hello.exe
with the command line toolpelook
:> pelook target\hello.exe | head -7 loaded "target\hello.exe" / 637952 (0x9BC00) bytes signature/type: PE64 EXE image for amd64 image checksum: 0x00000000 (calc=0x000AB346) machine: 0x8664 (amd64) subsystem: 3 (Windows Console) minimum os: 6.0 (Vista) linkver: 14.0