Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to bindgen? #2

Open
kallisti5 opened this issue Nov 17, 2021 · 3 comments
Open

Move to bindgen? #2

kallisti5 opened this issue Nov 17, 2021 · 3 comments

Comments

@kallisti5
Copy link

haiku-sys might want to consider migrating to bindgen.

https://docs.rs/bindgen/0.59.1/bindgen/

Essentially the bindings are auto-generated for you based on headers.

A smallish example project putting bindgen to work is here:

I confirmed bindgen does indeed compile under Haiku.

@nielx
Copy link
Owner

nielx commented Nov 17, 2021

Actually haiku-sys has been mostly (if not all) absorbed into libc, which is (infamously) manually maintained. Not sure if it makes sense to copy the efforts.

@sammoore
Copy link

@nielx is that also true of the Application Kit part as well? Would it make sense to use bindgen for the other kits in a separate lib (like this one) or am I missing something or thinking about this the wrong way?

@nielx
Copy link
Owner

nielx commented Dec 24, 2023

@nielx is that also true of the Application Kit part as well? Would it make sense to use bindgen for the other kits in a separate lib (like this one) or am I missing something or thinking about this the wrong way?

It is my opinion that anything in the higher level kits (UI or otherwise) is fundamentally incompatible with Rust, both because the Haiku API is fully based on the OO model, as well as the fact that the borrow checker's rules are incompatible with ownership rules in the Haiku API.

I don't have any experience with other bindings, but I think there is a reasonably useful GTK binding, where I suppose the C-Style OO is better reproducible in Rust. I think there is also a Qt binding, but last time I checked that bound to the QML layer of the API. This is in line with other attempts of using Rust for UI toolkits, where it seems the binding is for a declarative UI API, and the rendering/drawing is deferred to a lower level OO layer (like a browser DOM)

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

No branches or pull requests

3 participants