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

Will cbindgen generate opaque types for imported structs? #685

Closed
vedantroy opened this issue May 12, 2021 · 1 comment
Closed

Will cbindgen generate opaque types for imported structs? #685

vedantroy opened this issue May 12, 2021 · 1 comment

Comments

@vedantroy
Copy link

If I have:

use foo::{Bar};

pub unsafe extern "C" fn baz(x: &mut Bar) {
   // impl
}

will cbindgen generate an opaque type (typedef struct Bar Bar) for Bar?

I'm asking b/c it looks like cbindgen does not.

Apologies if this is in the user docs, I read through them & couldn't find an answer.

@emilio
Copy link
Collaborator

emilio commented Jun 15, 2021

Generally not, because it doesn't understand the rust module system more generally, that's a very long-standing issue (#7) . You can either forward-declare them yourself with C/C++, or let cbindgen parse the dependency...

I'd totally take a PR that improves the doc on this regard, probably pointing to #7, but as of now this is expected.

@emilio emilio closed this as completed Jun 15, 2021
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