Add C-ABI to provide an ABI stable interface and improve compatibility

Open
#87 0 comments 0 reactions 1 assignee View on GitHub

@joshbainbridge is already working on this.

Since Jun 29, 2026.

  • #95 by @joshbainbridge — open

Assessment

This issue has not been assessed yet.

Description

enhancement

OpenQMC is C++ header-only, so it can only be used directly from C++. Adding a stable C ABI would let any language with C FFI support use the samplers, including C, Zig, and Rust.

The C ABI should:

  • Wrap all six sampler types with extern "C" linkable symbols
  • Cover the full public API (cache management, construction, domain derivation, draw functions)
  • Preserve value semantics, no heap allocation
  • Be gated behind an OPENQMC_ENABLE_C_ABI CMake option
  • Keep boilerplate low when adding new samplers

This depends on the C++17 migration and removal of OPENQMC_ENABLE_BINARY being done first (#86). Larger goal is to make OpenQMC available to more languages to encourage broader adoption.

Dominant language
C++
Stars
106
Forks
7
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AcademySoftwareFoundation/openqmc

All issues in AcademySoftwareFoundation/openqmc

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.