Fortifying the Seams Between C/C++ and Rust: Characterizing Bugs in Interop Tools
Rust has become increasingly popular in recent years due to its safety and high performance. Despite these advantages, Rust projects rarely start from scratch in practice, and many Rust-based systems instead use hybrid programming, where Rust interoperates with existing C/C++ code. To reduce the manual effort involved in this interoperation (interop) process, several interop tools have been proposed to facilitate hybrid programming between Rust and C/C++. However, the challenges and limitations of these tools remain largely unexplored, leaving developers unclear about the future directions and users unclear about the appropriate usage scenarios. To fill the gap, we mined 320 bugs in the popular interop tools, i.e., Bindgen , Cbindgen , and CXX . We observe that the main obstacle is not tool crashes or performance issues, but the inability to generate correct and functional code. The leading types of the failures are generating code that is unfaithful to the original code's intent and generating incomplete code. Memory layout mismatch is the most common cause with Bindgen . Input with complex struct is the biggest challenge across tools, followed by the usage with specific tool configuration options for customized binding generation. Even input with primitive data types can be problematic. We also observe a common fix pattern that updates the control flow and condition. Based on our findings, we propose a series of suggestions to developers, users, and future researchers. For example, we suggest the developers validate configuration combinations, provide clearer documentation, and implement default-safe mechanisms to prevent failures related to unexpected tool configuration options.
Authors
- Lingxiao Jiang (ORCID: https://orcid.org/0000-0002-4336-8548)
- Xuemeng Cai
- Jiakun Liu (ORCID: https://orcid.org/0000-0002-7273-6709)
- Cunyang Liu
- Yijun Yu
- Lingfeng Bao
Institutions
- The Open University (GB)
- Harbin Institute of Technology (CN)
- Zhejiang University (CN)
- Singapore Management University (SG)
Publication Details
- Journal
- ACM Transactions on Software Engineering and Methodology
- Published
- 2026-02-03
- DOI
- https://doi.org/10.1145/3795532
- Primary Topic
- Logic, programming, and type systems
- Type
- article
- Field-Weighted Citation Impact
- 0.00