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

Are there C API (code bindings) and pre-built binaries? #206

Closed
ababo opened this issue Jan 19, 2023 · 7 comments · Fixed by #230
Closed

Are there C API (code bindings) and pre-built binaries? #206

ababo opened this issue Jan 19, 2023 · 7 comments · Fixed by #230

Comments

@ababo
Copy link

ababo commented Jan 19, 2023

I would like to link AccessKit to my Golang app.

@mwcampbell
Copy link
Contributor

Sorry, not yet. I want to land one more refactor (#205), and then community work on such things can begin.

@ababo
Copy link
Author

ababo commented Feb 7, 2023

I see #205 is already merged. Is there an estimate for addition of C API layer? Will it happen soon?

@DataTriny
Copy link
Member

Hi @ababo ,

We have started working on this. It is too early to give an ETA though.

@DataTriny
Copy link
Member

Status update: I've pretty much finished creating a C API for the common crate (the part needed to describe your UI), it is here. Actually, it would be great if you could give your opinion on it by having a look at its header file.

I'll implement the API for the platform adapters in the following days (which should be quick in comparison to what has already been done). By next week I should be able to move onto modifying our CI so we can ship pre-built binaries and headers.

Feedback much appreciated!

CC @bruvzg

@bruvzg
Copy link
Contributor

bruvzg commented Mar 1, 2023

Looks fine to me.

I assume char * strings are copies and objects returned by accesskit_*_new functions should be freed by the caller. So it should at least have a comment to indicate who's responsible for freeing stuff, and maybe have dedicated accesskit_*_destroy (or something similar) functions for the objects.

@mwcampbell
Copy link
Contributor

We need a function in the C API to free the C strings that are allocated by the getters. Since those strings are allocated by the Rust allocator, it's not safe to free them using the C standard library's free function. Also, in general, memory must always be freed by the same library that allocated it, particularly when the library is built as a DLL on Windows.

@DataTriny
Copy link
Member

I've just opened #230.

There are still some rough edges with slices and arrays, and I've not tested the bindings on macOS, but I hope to have this merged soon.

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 a pull request may close this issue.

4 participants