Skip to content

Latest commit

 

History

History
50 lines (39 loc) · 1.78 KB

README.md

File metadata and controls

50 lines (39 loc) · 1.78 KB

Learn Zig

Learning resources

Notes

  • usingnamespace

  • C optimization levels when using build.zig to build a C source file

  • zig cc without generating the pdb

  • zig fetch --save

  • Linking with pre-built dll

    • Copy dll next to exe
      const exe = b.addExecutable(.{...});
      exe.addIncludePath(b.path("vendor/SDL3-3.1.6/include"));
      exe.addLibraryPath(b.path("vendor/SDL3-3.1.6_build"));
      exe.linkSystemLibrary("SDL3");
      exe.linkLibC();
      
      b.installArtifact(exe);
      b.installBinFile("vendor/SDL3-3.1.6_build/SDL3.dll", "SDL3.dll");  // copy the dll to the exe path
    • Append dll dir to the PATH
      const exe = b.addExecutable(.{...});
      exe.addIncludePath(b.path("vendor/SDL3-3.1.6/include"));
      exe.addLibraryPath(b.path("vendor/SDL3-3.1.6_build"));
      exe.linkSystemLibrary("SDL3");
      exe.linkLibC();
      
      b.installArtifact(exe);
      
      const run_cmd = b.addRunArtifact(exe);
      run_cmd.step.dependOn(b.getInstallStep());
      run_cmd.addPathDir("vendor/SDL3-3.1.6_build"); // `addPathDir` adds a to the `PATH` environment variable.
                                                     // This is to avoid having to copy the dll to the exe path.