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
csbindgen connot generate C# Native method declarations from Rust 2024 edition sources
because some attributes (such as no_mangle and export_name) must now be marked as unsafe
using new introduced attribute unsafe but csbindgen cannot recognize it.
Workaround
Use 2021 edition and no_mangle and export_name without unsafe attribute.
Details
From Rust 1.82, some attributes has ability in all editions to mark as unsafe like this:
Last February 21, Rust 1.85 stable has been released with 2024 edition!
But in 2024 edition, these attributes must be marked as unsafe.
csbindgen cannot recognize unsafe attribute, so generated codes contains no DllImported native methods.
Reproduce
Extract the attached tarball.
Run cargo build.
Open ./target/csbindgen/NativeMethods.g.cs but It contains no DllImported methods.
Summary
csbindgen connot generate C# Native method declarations from Rust 2024 edition sources
because some attributes (such as
no_mangle
andexport_name
) must now be marked as unsafeusing new introduced attribute
unsafe
but csbindgen cannot recognize it.Workaround
Use 2021 edition and
no_mangle
andexport_name
withoutunsafe
attribute.Details
From Rust 1.82, some attributes has ability in all editions to mark as unsafe like this:
Last February 21, Rust 1.85 stable has been released with 2024 edition!
But in 2024 edition, these attributes must be marked as unsafe.
csbindgen cannot recognize
unsafe
attribute, so generated codes contains noDllImport
ed native methods.Reproduce
cargo build
../target/csbindgen/NativeMethods.g.cs
but It contains no DllImported methods.csbindgen-with-rust2024.tar.gz
The text was updated successfully, but these errors were encountered: