Skip to content

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

Description

@joshbainbridge

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.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions