-
Notifications
You must be signed in to change notification settings - Fork 327
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
support cfg_attr with repr() and no_mangle #183
Comments
Recognizing every possible attribute is kind of a lost cause, due to procedural attribute macros. Case in point: https://github.com/regexident/apply_attr Fortunately for those things there is cbindgen's [parse]
expand = ["crate-name"] … which will properly resolve your example, even without your PR #189. Using |
Using
But I agree, ideally we'd have the rust compiler figure out as much of this stuff as possible. Until that's ever feasible, this crate is going to try to be good enough for most sane use cases. |
Thanks for the response, @eqrion!
Given the caveats listed this is more than reasonable. :) A simple actionable workaround for such hard to catch meta-attributes might be to add support for adding defines via annotation 🤔 : // cbindgen: DEFINE=THAT_MAGICAL_PROC_MACRO
#[cfg_attr(feature = "magic", a_proc_macro_that_generates_more_attributes)]
pub struct Token { foo: u8 } |
cbindgen.toml:
> cbindgen -v -c ./cbindgen.toml -o ./include.h
So cbindgen sayd "INFO: Take api::Token - opaque (Struct is not marked #[repr(C)].)." and the output include.h is empty.
The text was updated successfully, but these errors were encountered: