Skip to content

✨ C-bindings Implementations#33

Merged
kayaercument merged 11 commits into
Munich-Quantum-Software-Stack:developfrom
kayaercument:c-bindings
Jul 7, 2026
Merged

✨ C-bindings Implementations#33
kayaercument merged 11 commits into
Munich-Quantum-Software-Stack:developfrom
kayaercument:c-bindings

Conversation

@kayaercument

Copy link
Copy Markdown
Collaborator

No description provided.

@kayaercument kayaercument marked this pull request as ready for review July 3, 2026 14:54
@kayaercument kayaercument self-assigned this Jul 3, 2026
@kayaercument kayaercument requested a review from mnfarooqi July 3, 2026 14:55
@mnfarooqi mnfarooqi requested a review from Copilot July 6, 2026 09:20
@mnfarooqi

Copy link
Copy Markdown
Collaborator
  • The CI pipeline has failed.
  • Would it make sense to move the C binding implementation into .c files, rather than mixing it with C++?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-tidy naming 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.

Comment thread .clang-tidy Outdated
Comment thread include/mqss-c/client.h
Comment thread include/mqss-c/client.h Outdated
Comment thread include/mqss-c/resource.h
Comment thread include/mqss-c/job.h
Comment thread src/client.cpp Outdated
Comment thread include/mqss-c/client.h
Comment on lines +28 to +44
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);
Comment thread src/resource.cpp Outdated
Comment thread src/client.cpp Outdated
Comment thread src/client.cpp Outdated
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>
@kayaercument

kayaercument commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

@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 CI pipeline has failed.

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.

  • Would it make sense to move the C binding implementation into .c files, rather than mixing it with C++?

@mnfarooqi

Copy link
Copy Markdown
Collaborator

Could you include this in the PR to ensure that everything is fine with the code?

We need to rewrite the CI pipeline. I will create another PR for this.

  • The CI pipeline has failed.

OK, then move the C-binding implementation to its own cpp files to simplify code maintenance.

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.

  • Would it make sense to move the C binding implementation into .c files, rather than mixing it with C++?

Comment thread .github/workflows/mqss_client-test.yml
@@ -1,36 +0,0 @@
# .github/workflows/publish.yml

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you delete this workflow? Don't we still need to publish it?

@mnfarooqi mnfarooqi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@kayaercument kayaercument merged commit 9a4178d into Munich-Quantum-Software-Stack:develop Jul 7, 2026
1 check passed
@kayaercument kayaercument deleted the c-bindings branch July 7, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants