openbim-ifc-capi
Versioned, memory-safe C ABI for openbim-ifc: read, edit and write IFC STEP files from C and C++.
| Status | Implemented |
| Latest release | 0.1.21 (2026-11-09) |
| Registries | GitHub release openbim_ifc |
| API documentation | rustdoc |
| Source | crates/openbim-ifc-capi/ |
Overview
Versioned C ABI for the IFC facade (ADR 0013, #38).
Every export is prefixed openbim_ifc_v0_1_ and follows the conventions of Axiolid's C ABI (its ADR 0040), so a native host can use both the same way:
- Models are opaque non-zero
u64handles, never Rust addresses. A stale or twice-destroyed handle isOpenbimIfcStatus::InvalidHandle. - The caller owns every output buffer. Each such call writes the size it needs to
out_requiredfirst; a null buffer with capacity 0 is the size query, and a short buffer isOpenbimIfcStatus::BufferTooSmall. No Rust allocation crosses the boundary, so there is no free function. - Every export runs inside
catch_unwind; a panic becomesOpenbimIfcStatus::Panicand never unwinds into C. - C integers are validated as integers, never read as Rust enums.
Attribute values cross as a value tape: a flat pre-order array of OpenbimIfcValueNode plus one byte buffer holding every string. See tape for the encoding, which carries the same kinds as the other bindings so $/*, .U./.F. and typed wrappers stay distinct.
Reading and writing caller-provided C buffers cannot be done without unsafe, so this crate's unsafe surface is its whole export set. It is not the only unsafe code in the workspace: the opt-in memory-mapped read (ifc_step::StepReader::read_path_mapped, wrapped by openbim-ifc-binding-core and openbim-ifc-py) is an unsafe fn too, because another process may change a mapped file. Here, each dereference sits in buffer or directly beside its null/length check, with a SAFETY comment.
The conventions above mirror Axiolid's ADR 0040 on purpose. A divergence needs its reason recorded in the module docs or an ADR. ABI 0.1 symbols are frozen once released: a change adds openbim_ifc_v0_2_ exports rather than altering a v0_1_ one.
Features
| Feature | Default | Enables |
|---|---|---|
graph | openbim-ifc-binding-core/graph | |
mesh | openbim-ifc-binding-core/mesh | |
rusty_alloc | dep:rusty_alloc-api, dep:rusty_alloc |
Depends on
Changes
Latest release, 0.1.21 (2026-11-09):
Changed (wire format 1.5)
- The geometry graph payload (#367) may be Axiolid's wire format 1.5, written only when a graph holds a ruled surface (axiolid/kernel#402); every other graph keeps its version. The newest version the build advertises (
GEOMETRY_FORMAT_VERSION) is"1.5". A reader onaxiolid-model0.3.17 or older refuses1.5.
Added (#603)
- The
SurfaceColourrecord's source can bematerialSet, its source entity then the set (IfcMaterialLayerSet,IfcMaterialProfileSet,IfcMaterialConstituentSetorIfcMaterialList, or a usage of one (IfcMaterialLayerSetUsage,IfcMaterialProfileSetUsageand itsTapering)), and it carries a new last child,source materials, aLISTofREF: the materials of the set that colour the item: every one, or the constituents its shape aspects name (ascending id, distinct), else empty. The record has 8 children; the earlier seven keep their positions. - ABI version 0.1.24; no
v0_1symbol changed.
Semver: additive, released on the 0.1 line.
Changed (#651)
representationacceptsReference, the void geometry of an IFC4 Reference View opening.
Semver: patch (additive).
Changed (#614)
- A diagnostic string with a position reads "warning at line L, column C (bytes a..b): ...".
Semver: patch (Display text changes)
Fixed (#617)
- The first id handed out after a read is above every declared and referenced id, so a new entity never takes the id of a dangling reference or a skipped record.
Semver: patch
Full history: crates/openbim-ifc-capi/CHANGELOG.md