You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bindgen generates incorrect return types for C++ class constructors in wasm32-unknown-emscripten, which causes linker warnings or even errors (when linking with -Wl,--fatal-warnings)
wasm-ld: warning: function signature mismatch: _ZN3FooC1Ei
>>> defined as (i32, i32) -> void in bindings.o
>>> defined as (i32, i32) -> i32 in class.o
Expected Results
No warnings/errors.
It appears that C++ constructors have an internal return value (which seemingly equals to this). However bindgen assumes that C++ constructors always return void, which causes function signature mismatches when linking code generated with bindgen with actual C++ object files.
I encountered this issue when trying to port skia-safe (which uses bindgen) to wasm32-unknown-emscripten.
The text was updated successfully, but these errors were encountered:
We have access to the target triple when we construct the BindgenContext, so it should be relatively easy to keep track of it and check it there. If you send a PR I'd happily merge it :)
Bindgen generates incorrect return types for C++ class constructors in
wasm32-unknown-emscripten
, which causes linker warnings or even errors (when linking with-Wl,--fatal-warnings
)Input C/C++ Header
custom.rs
bindings.rs
Bindgen Invocation
Actual Results
Expected Results
No warnings/errors.
It appears that C++ constructors have an internal return value (which seemingly equals to
this
). However bindgen assumes that C++ constructors always returnvoid
, which causes function signature mismatches when linking code generated with bindgen with actual C++ object files.I encountered this issue when trying to port
skia-safe
(which uses bindgen) towasm32-unknown-emscripten
.The text was updated successfully, but these errors were encountered: