Incorrect ABI when calling into C++ with bindgen on Windows #2848
Unanswered
hystericfleece
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a simple
.cpp
file which I give to bindgen:And the bindings it generates seem correct! However, when I try to call
getReversed
function, Rust for some reason passes a pointer to the result inrcx
, while the pointer to athis
struct is passed inrdx
, while C++ is actually uses them in the reversed order! So this member function will overwrite the actual input with garbage it got out fromrdx
pointer.Am I doing something incorrect? Would be glad for any help!
Here is a complete example: https://github.com/hystericfleece/rust-cpp-abi/tree/main
Also I started a discussion on Discourse: https://users.rust-lang.org/t/not-matching-abi-between-c-and-rust/112791
Beta Was this translation helpful? Give feedback.
All reactions