
Source Code Linking: Merging C Headers into Rust Modules - wmanley
https://immunant.com/blog/2019/12/header_merging/
======
leggomylibro
For using large C dependencies within Rust, `bindgen` is also a very nice
option.

[https://rust-lang.github.io/rust-bindgen/](https://rust-lang.github.io/rust-
bindgen/)

It does not attempt to help you refactor the C code, but it is still a great
way to call your C library from Rust while you are in the process of
refactoring. It can also work with `no_std` environments with a bit of
configuring.

~~~
bluejekyll
Bindgen is very nice for getting the C header into Rust, but it’s very much
direct FFI.

What I got from this post is that c2rust wants to take it a step further and
try to produce more idiomatic Rust, which is a very cool goal.

~~~
leggomylibro
Yeah, it took me awhile to realize that was the project's goal. It's very
ambitious and a terrifically cool idea.

------
im_down_w_otp
I really, _really_ want the opposite of this. Generating C from Rust, so that
I can compile it for platforms which have no prayer of getting Rust support
anytime soon or where a specific certified C toolchain has to be used.

~~~
igorkraw
[https://github.com/thepowersgang/mrustc/](https://github.com/thepowersgang/mrustc/)

Might want to check this out:-)

------
UglycupRawky
Nice! While being able to organize header declarations in submodules was very
useful, deduplication like this is a godsend.

