Is there a tool for generating C headers from Rust modules?

If you are writing a Rust library and want to call it C, you must flag all export functions with extern C and make sure everyone uses C ABI. But then you also need to write the header file manually to include it in your C code, and manually verify that it matches the definition of Rust, or Bad Things. It seems dangerous and tiring.

Is there a tool to generate C headers from Rust code? I have seen bindings that go the other way for using C from Rust, and this is actually the hardest problem!

+6
source share
2 answers

This seems to be the requested feature for Rust , but I have not found any implementations.

+4
source

It needs to be used so that I can smooth out the kinks, but yes .

+4
source

Source: https://habr.com/ru/post/977453/


All Articles