rust-lang / rust-lang/rust-bindgen
bindgen link wrong destructor in windows
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Input C/C++ Header
class RustCThostFtdcMdSpi:CThostFtdcMdSpi
{
public:
void *RustObject;
RustCThostFtdcMdSpi(void *RustObject)
}
RustCThostFtdcMdSpi::RustCThostFtdcMdSpi(void *RustObject):RustObject(RustObject){}
RustCThostFtdcMdSpi::~RustCThostFtdcMdSpi(){}
but the right address is 'RustCThostFtdcMdSpi@@QEAA@XZ'
Bindgen Invocation
let bindings = bindgen::Builder::default()
.header("src/wrapper.hpp")
.derive_debug(true)
.derive_default(true)
.generate()
.expect("Unable to generate bindings");
the bindgen function is
extern "C" {
#[link_name = "\u{1}??_DRustCThostFtdcMdSpi@@QEAAXXZ"]
pub fn RustCThostFtdcMdSpi_RustCThostFtdcMdSpi_destructor(this: *mut RustCThostFtdcMdSpi);
}
but the right link address is RustCThostFtdcMdSpi@@QEAA@XZ
I guess there is something wrong
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the C++ declaration in src/wrapper.hpp and the bindgen::Builder invocation shown in the issue. Inspect the generated extern block and compare the destructor's Windows link_name with the expected symbol address. Done means bindgen emits the correct destructor symbol for this input without breaking related C++ destructor bindings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100