rust-lang / rust-bindgen

Automatically generates Rust FFI bindings to C (and some C++) libraries.
https://rust-lang.github.io/rust-bindgen/
BSD 3-Clause "New" or "Revised" License
4.51k stars 702 forks source link

Support exporting re-exported types (those with pub use) #2016

Closed stevenroose closed 3 years ago

stevenroose commented 3 years ago

I'm trying to create C bindings for a lib.rs file that has a pub use somecrate::SomeEnum; that I import and I would like to be exported as well.

I can't seem to get that case to be supported. I tried adding include = [ "SomeEnum" ] to the cbindgen.toml without success. I tried to type SomeEnum = somecrate::SomeEnum; but then it creates a typedef referring to itself (:sweat_smile:).

emilio commented 3 years ago

Are you using parse_deps = true? if not, that probably fixes it.

emilio commented 3 years ago

Well, wrong project? This issue should be moved to https://github.com/eqrion/cbindgen, aiui. What you do should be supported, let me know if parse_deps doesn't work and I can look deeper into it there.

stevenroose commented 3 years ago

Ah yeah that worked, sorry I didn't close the issue. I initially thought parse_deps would expose all of the eligible types in all dependencies 😅

On Sat, Apr 3, 2021, 11:28 Emilio Cobos Álvarez @.*** wrote:

Well, wrong project? This issue should be moved to https://github.com/eqrion/cbindgen, aiui. What you do should be supported, let me know if parse_deps doesn't work and I can look deeper into it there.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rust-lang/rust-bindgen/issues/2016#issuecomment-812846244, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGQLXFZCW2LFGK6TLVQ54LTG3UU7ANCNFSM4Z7ZWH4Q .

emilio commented 3 years ago

If you submit a clarification to the documentation that'd be incredibly helpful. Glad it worked!

stevenroose commented 3 years ago

Would that be in this repo or in cbindgen?