@@ -14,10 +14,36 @@ to be available on the host system.
1414More specifically, ` python3-dll-a ` requires ` llvm-dlltool ` executable
1515to be present in ` PATH ` when targeting ` *-pc-windows-msvc ` .
1616
17- Example ` build.rs ` script
18- -------------------------
17+ PyO3 integration
18+ ----------------
1919
20- The following Cargo build script can be used to cross-compile Stable ABI
20+ Since version ** 0.16.4** , the ` pyo3 ` crate implements support
21+ for the Stable ABI Python DLL import library generation via
22+ its new ` generate-abi3-import-lib ` feature.
23+
24+ In this configuration, ` python3-dll-a ` becomes a ` pyo3 ` crate dependency
25+ and is automatically invoked by its build script in both native
26+ and cross compilation scenarios.
27+
28+ ### Example ` Cargo.toml ` usage for a PyO3 extension module
29+
30+ ``` toml
31+ [dependencies ]
32+ pyo3 = { version = " 0.16.4" , features = [" extension-module" , " abi3-py37" , " generate-abi3-import-lib" ] }
33+ ```
34+
35+ Standalone build script usage
36+ -----------------------------
37+
38+ If an older ` pyo3 ` crate version is used, or a different Python bindings
39+ library is required, ` python3-dll-a ` can be used directly
40+ from the crate build script.
41+
42+ The examples below assume using an older version of PyO3.
43+
44+ ### Example ` build.rs ` script
45+
46+ The following cargo build script can be used to cross-compile Stable ABI
2147PyO3 extension modules for Windows (64/32-bit x86 or 64-bit ARM)
2248using either MinGW-w64 or MSVC target environment ABI:
2349
@@ -40,8 +66,7 @@ A compatible `python3.dll` import library file named `python3.dll.a`
4066or ` python3.lib ` will be automatically created in the directory
4167pointed by the ` PYO3_CROSS_LIB_DIR ` environment variable.
4268
43- Example ` cargo build ` invocation
44- --------------------------------
69+ ### Example ` cargo build ` invocation
4570
4671``` sh
4772PYO3_CROSS_LIB_DIR=target/python3-dll cargo build --target x86_64-pc-windows-gnu
0 commit comments