Skip to content

openbim-ifc-capi ​

Versioned, memory-safe C ABI for openbim-ifc: read, edit and write IFC STEP files from C and C++.

StatusImplemented
Latest release0.1.21 (2026-11-09)
RegistriesGitHub release openbim_ifc
API documentationrustdoc
Sourcecrates/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 u64 handles, never Rust addresses. A stale or twice-destroyed handle is OpenbimIfcStatus::InvalidHandle.
  • The caller owns every output buffer. Each such call writes the size it needs to out_required first; a null buffer with capacity 0 is the size query, and a short buffer is OpenbimIfcStatus::BufferTooSmall. No Rust allocation crosses the boundary, so there is no free function.
  • Every export runs inside catch_unwind; a panic becomes OpenbimIfcStatus::Panic and 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 ​

FeatureDefaultEnables
graphopenbim-ifc-binding-core/graph
meshopenbim-ifc-binding-core/mesh
rusty_allocdep: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 on axiolid-model 0.3.17 or older refuses 1.5.

Added (#603) ​

  • The SurfaceColour record's source can be materialSet, its source entity then the set (IfcMaterialLayerSet, IfcMaterialProfileSet, IfcMaterialConstituentSet or IfcMaterialList, or a usage of one (IfcMaterialLayerSetUsage, IfcMaterialProfileSetUsage and its Tapering)), and it carries a new last child, source materials, a LIST of REF: 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_1 symbol changed.

Semver: additive, released on the 0.1 line.

Changed (#651) ​

  • representation accepts Reference, 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

Dual-licensed under AGPL-3.0-or-later or a commercial licence. ISO and CEN standards material is not redistributed.