Skip to content

Classes result in build warnings; build failure on Windows #54

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

Closed
adetaylor opened this issue Oct 29, 2020 · 2 comments
Closed

Classes result in build warnings; build failure on Windows #54

adetaylor opened this issue Oct 29, 2020 · 2 comments

Comments

@adetaylor
Copy link
Collaborator

A struct with methods gets processed nicely by bindgen, autocxx and cxx.

A class with methods results in compile warnings because:

  • bindgen outputs a Rust struct
  • autocxx passes struct-like information to cxx
  • cxx generates C++-side bindings which include a forward declaration for this class... but calls it a struct. Therefore the compiler whines. Apparently on Windows this would actually be a bug due to ABI mismatch between structs and classes. (In the title of the issue I call this a 'build failure' but I'm not sure).

Currently the information output from bindgen doesn't tell us whether something is a class or a struct. We will need a small bindgen change to add a bit more information to the outputted code. I have a hacky branch for this; if anyone wants to clean it up let me know and I'll upload the hacks somewhere.

@adetaylor adetaylor mentioned this issue Apr 16, 2021
8 tasks
@adetaylor
Copy link
Collaborator Author

Taking another look here: this problem doesn't seem to exist any more. It might be that cxx has changed to no longer generate those forward declarations. I also now regret not adding a citation for the bit labelled "apparently" above: I'm sure I wasn't imagining it but I can't find it. I'll close this issue for now though I'm pretty confident it'll reappear.

@fzyzcjy
Copy link
Contributor

fzyzcjy commented Nov 15, 2021

Btw in README it says Works, except on Windows pointing to here. So if it is not a bug you may change the readme ;)

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

2 participants