esp-idf-sys icon indicating copy to clipboard operation
esp-idf-sys copied to clipboard

How can we get bindgen output with wrap_static_fns() ?

Open gopakumarce opened this issue 2 years ago • 4 comments

So for example I want to include esp32/incude/hal/i2s_ll.h and all the static inlines inside it, but by default all the static inlines are not generated in the bindings. How can I include wrap_static_fns() so that I get the inline utility APIs inside i2s_ll.h ? From my project's build.rs can I pass in something to the embuild flags or anything of that sort to achieve this ?

gopakumarce avatar May 18 '23 23:05 gopakumarce

wrap_static_fns is a brand new, experimental feature of bindgen and as such it is not supported out of the box in esp-idf-sys. Moreover, it is not just about "passing the flag to bindgen", as in that case bindgen would generate a C file too, that you need to compile with clang (or gcc would do as well?) and then you need to use cargo build cmds to pass down the compiled output to the linker.

Not a rocket science, but would require some changes to esp-idf-sys - in the native as well as in the pio code paths, (as long as it can even be supported in the latter).

Might also require a small change to embuild so that it's bindgen dependency is updated to a version which supports bindgen 0.65, if that's not the case already.

All in all it would require a PR. Are you willing to work on that?

ivmarkov avatar May 19 '23 04:05 ivmarkov

@ivmarkov yes ill take a stab at it

gopakumarce avatar May 19 '23 11:05 gopakumarce

PR here https://github.com/esp-rs/esp-idf-sys/pull/202

gopakumarce avatar May 22 '23 11:05 gopakumarce

We now use bindgen 0.69 both in embuild and this crate. I think they made additional changes how to handle inline functions across FFI layer, but it seams that it would still need a lot of handholding on our part.

Vollbrecht avatar Jun 21 '24 12:06 Vollbrecht