Publication Type

Journal Article

Version

acceptedVersion

Publication Date

2-2026

Abstract

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.

Keywords

Rust, interop, C/C++, empirical study, bug characteristics

Discipline

Software Engineering

Research Areas

Software and Cyber-Physical Systems

Publication

ACM Transactions on Software Engineering and Methodology

First Page

1

Last Page

23

ISSN

1049-331X

Identifier

10.1145/3795532

Publisher

Association for Computing Machinery (ACM)

Copyright Owner and License

Authors

Additional URL

https://doi.org/10.1145/3795532

Share

COinS