-
Notifications
You must be signed in to change notification settings - Fork 321
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
Using libc::[some c-struct] in function gets export without struct keyword #539
Comments
What is the whole configuration you're using? |
|
Hmm, right... I think the issue is that cbindgen is not parsing We could conceptually get some knowledge about libc in cbindgen, but that seems a bit brittle and lacking that... I don't think there's an straight-forward solution. Does using |
Nope... It's fine, it's a minor issue and renaming works fine. A bigger issue with build.rs is that cbindgen runs before rustc so any build errors are detected by cbindgen instead of rustc so I moved it to a Makefile instead. I wish we had pre/post build script support in cargo... |
Yeah... in practice in Firefox we use cbindgen from the cli interface for these kinds of things. |
I was unable to get renaming working because cbindgen has apparently become clever in the last few years and knows that e.g. I have managed to 'trick' cbindgen into working by: lib.rs
cbindgen then:
Which ends up with correct usage of
Note that this workaround may break if #7 gets fixed. |
Hi
I'm writing a Rust library with C interface where I'm using libc structs in function arguments. The generated header file then ends up with type like "sockaddr" instead of "struct sockaddr".
I solved this by renaming like this
Is this the way to go or am I missing a "nicer" solution?
The text was updated successfully, but these errors were encountered: