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

Add no-export in cbindgen.toml config #924

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

tisonkun
Copy link

@tisonkun tisonkun commented Feb 1, 2024

@aidanhs @emilio

I need it for my c binding of OpenDAL and local tests pass with this change.

Let me know if this patch needs some improvement :D

.export
.no_export
.iter()
.any(|i| i == item.deref().export_name())
Copy link
Author

Choose a reason for hiding this comment

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

I'm not very sure if export_name is desired here but it works for me locally.

@@ -179,6 +179,15 @@ impl Builder {
self
}

#[allow(unused)]
Copy link
Author

Choose a reason for hiding this comment

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

I don't know how it works but follow the "include"/"exclude" pattern above.

Copy link
Collaborator

@emilio emilio left a comment

Choose a reason for hiding this comment

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

Thanks, this is probably fine with better docs and a test.

docs.md Show resolved Hide resolved
* Outer docs should be exported.
*/
typedef struct {
Inner *inner;
Copy link
Author

Choose a reason for hiding this comment

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

@emilio weird. When I use the same code for opendal c binding, it generates something like struct Inner *inner for such field. But in cbindgen tests it cannot generate the correct result.

@tisonkun
Copy link
Author

tisonkun commented Feb 28, 2024

It seems that for Style::Tag and Language::C, my work case can pass. But the test coverage also check for other style and language like pyx. The previous no-export attr should share the same issue.

@emilio what would you suggest to write a test? I cannot write a proper test for it but it's the same as when we previously merge "no-export` attr.

@tisonkun tisonkun requested a review from emilio March 9, 2024 12:14
@emilio
Copy link
Collaborator

emilio commented Apr 14, 2024

It seems that for Style::Tag and Language::C, my work case can pass. But the test coverage also check for other style and language like pyx. The previous no-export attr should share the same issue.

@emilio what would you suggest to write a test? I cannot write a proper test for it but it's the same as when we previously merge "no-export` attr.

For tests, you can include relevant boilerplate using config.header or so to make the test files compile, right? We do that in a bunch of tests.

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.

2 participants