Skip to content

RFC/Suggestion to add a more native Zig API#18

Closed
GrayHatter wants to merge 21 commits intoallyourcodebase:mainfrom
GrayHatter:main
Closed

RFC/Suggestion to add a more native Zig API#18
GrayHatter wants to merge 21 commits intoallyourcodebase:mainfrom
GrayHatter:main

Conversation

@GrayHatter
Copy link
Copy Markdown

@GrayHatter GrayHatter commented Feb 24, 2026

This PR is no where near complete; But wanted to open this PR to offer a suggestion and/or get feedback. I would rebase and create a stack of clean commits if there's any interest.

Context; I'm in the process of making a FFT waterfall toy thing, but I'm not a fan of the raw C api, so after upgrading it to work with zig master I started working on a more zig friendly API. It's currently far from complete, but I'd be happy to expand it to as much of the pipewire API as I'm able.

an example of it in use contrast
before: https://srctree.gr.ht/repo/vizz/ref/2888db992d339b5455358a7ea8c26b4b9bda2253/blob/src/pipewire.zig#L54
after https://srctree.gr.ht/repo/vizz/ref/5e34965905d485d4cc1ea73de7d4acfb3454e78c/blob/src/pipewire.zig#L33 The zig native API requires fewer lines, and includes error handling.

I'd apprecate any comments, suggestions, or insults. Or please close this if a zig API is out of scope.

Cheers

@Cornspies Cornspies mentioned this pull request Apr 13, 2026
@MasonRemaley
Copy link
Copy Markdown
Contributor

MasonRemaley commented Apr 13, 2026

(Whoops, sorry for letting this sit--I had notifications off by mistake.)

I think this is a great idea. I'm not a fan of the C API, and regardless, it's nice to have integration with Zig's error handling and such.

The right way to do this IMO is to keep this repo unopinionated--have it continue to just expose the C API as is--but then have a separate repo imports this one, and wraps it with the Zig bindings. (This is also the approach suggested by AYC).

If you're still interested in this project and are down to split it into a separate repo, I can add a link from the README to point people to it!

@MasonRemaley
Copy link
Copy Markdown
Contributor

(btw thanks for the updates for latest Zig!)

@GrayHatter
Copy link
Copy Markdown
Author

That sounds good to me. I'll create a 2nd repo, and remove all the commits from this PR into that leaving just the changes needed to get 0.16 working on this one.

Do you have any preference as to what to do about the changes to stat() full support was removed from ziglang, so I've only added the stub for x86_64.

@MasonRemaley
Copy link
Copy Markdown
Contributor

It looks like @Cornspies already pulled out the 0.16 related commits from your branch in #20–wanna move this convo there?

@GrayHatter
Copy link
Copy Markdown
Author

looking at the commits in #20 it looks he added his own implementation, instead of pulling mine. But yeah if you wanna close this one and merge #20 to add 0.16 that works for me too :)

@MasonRemaley
Copy link
Copy Markdown
Contributor

MasonRemaley commented Apr 15, 2026

Sounds good! I believe their implementation was based off of yours even if it doesn't have the actual commits in history. Feel free to ping me if/when you get the bindings set up and want me to link to them!

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.

2 participants