FORGE KUI / docs

Use the C ABI

Manage windows and documents through public handles and the package examples.

Version 3.61.7

Package and interface

The interface is declared in kui_c.h. Windows x64 Full Profile freezes 195 exports. Runtime libraries and the ABI header must come from matching delivery artifacts. Check C SDK and core versions separately; replacing a single DLL does not establish compatibility.

Start with the standard examples

Run the package's precompiled C examples and canonical scenarios first, then rebuild them using the package instructions. The source C++ wrapper uses the same C ABI but is not a replacement header for the native C++ SDK.

Ownership and callbacks

Pair handle creation, retention and release. Never pass a released document or element back into the API. Callbacks are subject to event-dispatch lifetimes; return asynchronous work to the UI thread before accessing a window or DOM.

Rebuild a C window

Run from the C SDK root. Point KuiC_DIR at its cmake folder. The target name comes from examples/CMakeLists.txt; the trailing 0 disables automatic exit.

powershell
cmake -S examples -B build -A x64 -DKuiC_DIR=C:/SDK/kui-c/cmake
cmake --build build --config Release --target kui_c_example_window_demo --parallel 4
.\build\Release\kui_c_example_window_demo.exe 0

Start with the packaged window example

hello_world.c is a headless ABI example. Use window_demo for a visible window. It exits on a timer by default; pass 0 to keep it open for interaction.

  1. Keep the package include, lib, bin and examples layout.
  2. Read examples/window_demo.c and example_common.h; import KuiC::C with the package CMake setup.
  3. Run window_demo, then change a heading or text; check returned status codes.
  4. Release owned handles on exit and avoid retaining invalid element references in callbacks.

Separate strings from handles

Use the header’s length-query and buffer rules for variable-length strings, allocating and freeing on the same side. Do not cast a C++ object address to KuiElement*. Follow each function’s owned or borrowed handle contract.