✨ C-bindings Implementations#33
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR introduces initial C bindings for the MQSS Client library by adding C-facing headers (include/mqss-c/*) and implementing C ABI wrapper functions in the existing C++ implementation files, alongside a few related API/config adjustments.
Changes:
- Add new C API headers for client/job/resource and implement corresponding wrapper functions in
src/*.cpp. - Adjust CMake project languages/options to support building bindings.
- Update
.clang-tidynaming ignore settings and make small Python bindings property-name/formatting tweaks.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 27 comments.
Show a summary per file
| File | Description |
|---|---|
| src/resource.cpp | Adds C ABI wrappers for Resource/Gate info and a helper to flatten 2D vectors. |
| src/job.cpp | Adds C ABI job creation + result helpers (counts + timestamps). |
| src/client.cpp | Adds C ABI wrappers for creating a client, listing resources, submitting/cancelling jobs, and fetching results. |
| include/mqss/resource.h | Adds Gate copy/move ops and changes Resource::getNativeGateset() accessor. |
| include/mqss/client.h | Adds wrap/unwrap pointer-cast helpers for C ABI handles. |
| include/mqss-c/resource.h | New C header for resource/gate handle types and query APIs. |
| include/mqss-c/job.h | New C header for job/job-result handle types and query APIs. |
| include/mqss-c/client.h | New C header for client handle type and main C APIs. |
| CMakeLists.txt | Enables C as a project language and adds a bindings build option. |
| bindings/resource.cpp | Formatting-only change for Python Gate bindings. |
| bindings/job.cpp | Renames Python JobResult properties to timestamp_*. |
| .clang-tidy | Modifies naming ignore regex (currently invalid YAML due to an unterminated string). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| typedef struct MQSSOpaqueClient* MQSSClientRef; | ||
|
|
||
| MQSSClientRef MQSSClientCreateClient(char* token, char* urlOrQueue, bool isHpc); | ||
|
|
||
| MQSSResourceRef* MQSSClientGetAllResources(MQSSClientRef client, int* size); | ||
|
|
||
| MQSSResourceRef MQSSClientGetResourceInfo(MQSSClientRef client, | ||
| char* resourceName); | ||
|
|
||
| int MQSSClientSubmitJob(MQSSClientRef client, MQSSJobRef job); | ||
|
|
||
| void MQSSClientCancelJob(MQSSClientRef client, MQSSJobRef job); | ||
|
|
||
| MQSSJobResultRef MQSSClientGetJobResult(MQSSClientRef client, MQSSJobRef job, | ||
| bool wait, unsigned int timeout); | ||
|
|
||
| int MQSSClientGetNumberPendingJobs(MQSSClientRef client, char* resourceName); |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Ercüment Kaya <49598189+kayaercument@users.noreply.github.com>
|
@mnfarooqi Thank you for the review. I committed the suggested changes. We need to rewrite the CI pipeline. I will create another PR for this.
The implementation still relies on C++ types and features. The bindings only expose a C ABI, so they need to be compiled as C++ even though they're callable from C.
|
|
Could you include this in the PR to ensure that everything is fine with the code?
OK, then move the C-binding implementation to its own cpp files to simplify code maintenance.
|
| @@ -1,36 +0,0 @@ | |||
| # .github/workflows/publish.yml | |||
There was a problem hiding this comment.
Why did you delete this workflow? Don't we still need to publish it?
9a4178d
into
Munich-Quantum-Software-Stack:develop
No description provided.