Skip to content

Conversation

robertblackwell
Copy link

HI, I am new to Zig and found your repo while looking for hints on how to compile and link C projects with zig build.

So I cloned your repo and set to work trying to get it working and understand it. It helped a lot even though it did not work.
My zig is 0.15.1 and there have been some breaking changes. Which I think I have fixed. They are:

  1. stream Io has changed so your print(..) stuff did not work. See the diff between your repo and my branch zig-0.15
  2. also callconv(.C) now requires callconv(.c) - lower case not upper.
    In addition you used exe.addObjectFile(b.path("zig-out/lib/zmath-shared.lib")); to pull in the libraries. That library name is windows specific. I changed those statements to exe.linkLibrary(lib) where lib is passed into the specific build script as an argument.
  3. I also added 2 more pure c examples - linking a c program against the static and the shared libraries.
  4. Finally made an effort to update the readme fil.
    Anyway if you like the fixes/changes feel free to accept the pull. If not no sweat.
    Rob

Robert BLACKWELL added 2 commits September 14, 2025 17:00
…ace in zig 0.15

2. Improved method of linking apps against shared and static libraries. Use `linkLibrary()`
function rather than `addObject()`. This is better  because one does not have to specify the library file name
which vary by system type.

3. Added 2 more pure c examples. Link against a static lib and link against a dynamic lib

4 Another breaking change `callconv(.c)` the .c should now be lowercase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant