Closed
Description
Bug Description
Projects utilizing cffi
bindings do not run after migrating to Rust 2024. Reason for this is the use of unsafe
attributes. This changes the #[no_mangle]
attribute into #[unsafe(no_mangle)]
.
Maturin currently depends on cbindgen 0.27
which is unable to parse unsafe attributes. An update to cbindgen 0.28
should fix this.
See #2498
Your maturin version (maturin --version
)
maturin 1.7.8
Your Python version (python -V
)
Python 3.13.2
Your pip version (pip -V
)
pip 24.3.1
What bindings you're using
cffi
Does cargo build
work?
- Yes, it works
If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /
)?
- Yes
Steps to Reproduce
- Build any project with cffi bindings utilizing at least one exported function from Python
- Run any python code supposed to call that function. This results in an error:
cffi library '<path to dynamic library>' has no function, constant or global variable named '<unmangled function name>'