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

Generates functions outside of capi.rs #133

Closed
Enulp opened this issue Nov 17, 2020 · 5 comments
Closed

Generates functions outside of capi.rs #133

Enulp opened this issue Nov 17, 2020 · 5 comments

Comments

@Enulp
Copy link

Enulp commented Nov 17, 2020

Link for the example: https://gitlab.com/enulp/cargo-c-test

As I understand cargo-c expose the C-API from functions inside capi.rs
But in the example above it also generates function from the sys.rs file.
Is it normal?

@lu-zero
Copy link
Owner

lu-zero commented Nov 17, 2020

It generates C definitions for every public function or struct that is C-compatible, it is not limited to a specific file.

@Enulp
Copy link
Author

Enulp commented Nov 17, 2020

Is there a way to specify a file?

@lu-zero
Copy link
Owner

lu-zero commented Nov 17, 2020

Not explicitly.

Please refer to the cbindgen manual, I'm not sure what are you trying to achieve, but maybe you'll find a way.

cargo-c uses cbindgen to generate the header.

@Enulp
Copy link
Author

Enulp commented Nov 18, 2020

Thanks for your help

The solution was explained in mozilla/cbindgen#484.
I needed to remove pubfrom pub mod sys and add /// cbindgen:ignore behind it in lib.rs

@lu-zero
Copy link
Owner

lu-zero commented Nov 21, 2020

I guess this issues can be closed now?

@Enulp Enulp closed this as completed Nov 30, 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

No branches or pull requests

2 participants