The current macro translation solution has many defects, such as being unable to translate a simple integer type conversion. Therefore, I implemented a macro translation solution based on lang-c using recursive transformation. A simple hack implementation is here (non-invasive to bindgen, because modifying the bindgen library seems like a big project):
https://github.com/823984418/lang-c/blob/hack-for-bindgen/src/hack_bindgen.rs
This is an example of my use of it:
https://github.com/823984418/hc32_driver_sys
I think this is a great idea, so I’m sharing it here. The implementation is still rough, but it simply expresses what I want to achieve.
The current macro translation solution has many defects, such as being unable to translate a simple integer type conversion. Therefore, I implemented a macro translation solution based on lang-c using recursive transformation. A simple hack implementation is here (non-invasive to bindgen, because modifying the bindgen library seems like a big project):
https://github.com/823984418/lang-c/blob/hack-for-bindgen/src/hack_bindgen.rs
This is an example of my use of it:
https://github.com/823984418/hc32_driver_sys
I think this is a great idea, so I’m sharing it here. The implementation is still rough, but it simply expresses what I want to achieve.