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

Asynchronous operation #51

Closed
adetaylor opened this issue Oct 23, 2020 · 0 comments · Fixed by #171
Closed

Asynchronous operation #51

adetaylor opened this issue Oct 23, 2020 · 0 comments · Fixed by #171

Comments

@adetaylor
Copy link
Collaborator

At the moment this project generates all its Rust code in a procedural macro, invoking bindgen (and thus llvm) during Rust compilation to parse C++ headers and convert to a Rust token stream.

Whilst it's rather awesome that it works, this has the following downsides:

  • We parse the C++ headers at least twice (once during Rust compilation and once during generating C++ bindings)
  • We need to do the work all over again for each time the Rust is compiled
  • Some say it's not the way procedural macros are supposed to behave

Since we have to run a tool to generate the C++ side of the bindings anyway, I intend to switch to a mode where:

  • That tool generates both Rust and C++ side of the bindings
  • On compilation, the include_cpp! macro (or future equivalent per Nicer syntax for include_cpp #42) simply expands to an include! macro invocation which pulls in the generated code.

This should be straightforward, although it's my intention that the filename of the generated code may want to depend upon the full parameters passed to the include_cpp! macro, to ensure there's lower risk of pulling in outdated generated code, so this may still need to be a small procedural macro.

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.

1 participant