PyO3 / maturin

Build and publish crates with pyo3, cffi and uniffi bindings as well as rust binaries as python packages
https://maturin.rs
Apache License 2.0
3.98k stars 275 forks source link

Add the *.lib file to the wheel built by maturin on Windows (with the cffi bindings) #2289

Open brycebjork opened 3 weeks ago

brycebjork commented 3 weeks ago

I've found maturin to be a very useful way to package and distribute cross-platform dynamic libraries (using cffi bindings). The dynamic libraries can then be used from python or executables can be built and linked against them. The second flow works well on linux and mac, but Windows fails due to the lacking *.lib file containing the required symbols.

On Windows, the .lib file is generated along with the .dll file and is very small. I propose that the .lib file should be bundled into the wheel built by maturin along with the .dll to enable other programs to be linked against the dll.

messense commented 3 weeks ago

Do you have a reproducible example? Windows .lib files are usually static libraries or import libraries which are only used in compliation not in runtime, so I'm not sure what the exact issue you were having and how/why bundling .lib files will help fix it.

Edit:

The dynamic libraries can then be used from python or executables can be built and linked against them.

so you want to distribute the wheel for others to link to the dylibs in it? I guess it's a valid feature request but I don't think it should be on-by-default.