Skip to content

Support writing Rust/Python extension modules with the raw C API #15985

@jakelishman

Description

@jakelishman

The current way the C API is exposed for C/Python extension modules is dependent on being able to directly use the header files, and to call the header-only qk_import function. This means that it is not easily possible to write extension modules in other languages (such as Rust) that interact with Python-space Qiskit.

We do not intend to first-party own an idiomatic-Rust wrapper library for Qiskit, nor to first-party own raw vtable definitions for every language, but given the importance of Rust to Qiskit itself, it feels reasonable that we could own the logical equivalents of qiskit-sys (system-library bindings) and (new) qiskit-py (vtable bindings through Python, similar to https://github.com/PyO3/rust-numpy).

This would only involve providing the raw FFI bindings in terms of raw pointers (like pub unsafe extern "C" fn qk_circuit_new(u32, u32) -> *mut QkCircuit), not any idiomatic safe abstraction on top of this.

Metadata

Metadata

Assignees

Labels

C APIRelated to the C APItype: feature requestNew feature or requesttype: qaIssues and PRs that relate to testing and code quality

Type

No type

Projects

Status

Ready

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions