Skip to content

Conversation

@adetaylor
Copy link
Collaborator

This avoids problems with duplicate definitions when the
generated .cc ends up including the generated .h via intermediate
includes.

I may yet add another commit here to add some test code.

Fixes #230.

This avoids problems with duplicate definitions when the
generated .cc ends up including the generated .h via intermediate
includes.
@adetaylor adetaylor marked this pull request as draft July 31, 2020 22:37
@dtolnay dtolnay marked this pull request as ready for review August 1, 2020 01:53
Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I'll merge this as is, with just a small tweak I pushed.

On testing -- one thing I would love to get is a representative integration test project. The test crate we have in https://github.com/dtolnay/cxx/tree/0.3.4/tests/ffi is geared toward exhaustively covering the code generator to tell that it produces compilable code for all the combinations of types you could pass/return, by value/by reference, rust->c++ / c++->rust, infallible/fallible, etc. But so far it makes no attempt to imitate a realistic project structure with multiple libraries involved. As things get somewhat figured out on your end, it would be amazing if you could share links or brief explanations to help reproduce something resembling that structure as a test project here.

@dtolnay dtolnay merged commit 8cfdd7d into dtolnay:master Aug 1, 2020
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 this pull request may close these issues.

Add ifdef around shared struct definitions

2 participants