Skip to content

doongjohn/learn-zig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages