Integrate with C libraries

Integrate with C libraries in C++ — with the four heights of help laid out: do it now, make it easier for the next person to accept, work out the right move when you are stuck, and learn the pattern so it stops coming back.

4prompt heights
Open it in the interactive atlas →

The four heights

The same task, four distances: today's deadline, the next reviewer, the stuck moment, the pattern.

Execute — do the immediate task

+
We have to call an existing C graphics library from our C++ renderer. Add thin, exception-safe…
We have to call an existing C graphics library from our C++ renderer. Add thin, exception-safe wrappers so the renderer can use the API without leaking C semantics. Create header renderer/native_texture.h and implementation files that manage the C handle lifetime, translate error codes into std::error_code, and provide both move and copy semantics only where safe. Update one example in samples/textured_quad.cpp to use the wrappers.

Improve — make it easier to accept

+
Before I hand the integration to QA, make the wrapper easy to accept. Surface the ownership model…
Before I hand the integration to QA, make the wrapper easy to accept. Surface the ownership model at the top of the header, put the error mapping table and common failure modes on the first page, provide a small usage snippet showing correct lifetime and an anti-pattern snippet showing what not to do, and flag any C API behaviors (internally-owned callbacks, thread-affinity) that may surprise reviewers.

Decide — diagnose the stuck moment

+
I wired the C library's async callback to a C++ method on TextureLoader, and during stress tests…

Callback from the C library crashes in our C++ callback object.

I wired the C library's async callback to a C++ method on TextureLoader, and during stress tests the process crashes inside that callback. I suspect the C library calls on a different thread or after our object is destroyed. I cannot change the C API. What is the most likely diagnosis and the safest change to make now so callbacks never access freed C++ state, while keeping throughput reasonable?

Become — change the pattern

+
Across multiple projects we keep hitting threading and lifetime bugs when integrating C libraries:…

Each integration leaks subtle ownership and threading assumptions.

Across multiple projects we keep hitting threading and lifetime bugs when integrating C libraries: callbacks invoked on unknown threads, opaque handles that owners drop, and error codes swallowed. I waste cycles adding ad-hoc shims per library. What consistent pattern or small library should I adopt across the team to standardize ownership, thread-safety, and error translation so future integrations are predictable?

Next to this one

Other programming language work people do in C++.

Every task here came from the work, not from a feature list — which is why the prompts name what you want done and never the button that does it. The tool changes; the work does not.
Copyright © LLOS.ai · 2026 — original pedagogy, voice, and design — all rights reserved.

The rest of the map

Same library, five ways in.