cmn (C Multiplatform Native) is a lightweight, high-performance, and entirely native GUI framework written in strict C90. It provides a unified API for building cross-platform native graphical user interfaces across desktop, mobile, and web (WASM) without sacrificing platform-specific look and feel or binary size.
- Truly Native Interfaces: Uses native OS windowing and UI toolkits under the hood (Win32, Cocoa, GTK, Android SDK, iOS UIKit, Web DOM).
- Responsive Flexbox & Grid Layout: CSS Flexbox (
cmn_flex_t) and CSS Grid (cmn_grid_t) layout engines with responsive breakpoints and automatic window resize reflow (cmn/layout.h). - Strict C90 Conformance: Builds with the widest possible range of compilers, ensuring unmatched portability.
- Modern State Management: Includes an Angular-inspired reactive
Signalssystem for state management (cmn/signals.h). - Routing & Navigation: Features a robust SPA-style router with deep linking support (
cmn/router.h), ideal for building complex multi-view applications. - Form Management: Built-in validation, debounce support, and multi-step (wizard) workflows (
cmn/form.h). - Accessibility (a11y) & Internationalization (i18n): Out-of-the-box support for screen readers, RTL languages, and tab-indexing (
cmn/a11y_i18n.h). - UI Automation & Testing: First-class support for programmatic interaction, screenshot capturing, and keyboard simulation for comprehensive regression testing (
cmn/automation.h). - Memory & Error Safety: Clean, predictable error-code-based return types with built-in safe string manipulation primitives.
Operating Systems:
- Windows: Win32 API
- macOS: Cocoa / Objective-C
- Linux: Native toolkits (e.g., GTK)
- iOS: UIKit
- Android: Android NDK / JNI
- Web: WebAssembly (WASM)
Compilers:
- GCC
- Clang / Apple Clang
- MSVC (Microsoft Visual C++)
Note: Built with highest strictness levels (-Wall -Wextra -Wpedantic -Werror or /W4 /WX).
All screenshots below are real native OS captures generated by the C screenshot_gen executable (examples/screenshot_gen) running on the host and inside local Bento (../bento) Vagrant VMs (bento/debian-13 and bento/windows-11) into ../cc0-assets/c-multiplatform-native/screenshots, demonstrating how cmn maps a single unified C89 API onto native platform controls across macOS (Cocoa / AppKit), Windows 11 (Win32 / ComCtl32 v6), Linux (GTK3 / Adwaita), and Web (WASM / HTML5 DOM).
macOS (Cocoa / NSWindow) |
Windows 11 (Win32 / HWND) |
|---|---|
![]() |
![]() |
Linux (GTK3 / GtkWindow) |
Web (WASM / HTML5 DOM) |
![]() |
![]() |
| macOS (Cocoa) | Windows 11 (Win32) |
|---|---|
![]() |
![]() |
| Linux (GTK3) | Web (WASM) |
![]() |
![]() |
Screenshots are generated using pure C89 (no Python required):
cmake -B build -S . -DBUILD_TESTING=ON
cmake --build build --target screenshot_gen
./build/bin/screenshot_gen --output-dir ../cc0-assets/c-multiplatform-native/screenshotsTo replicate builds, tests, and native screenshot capture across isolated guest OS environments using the local Bento (../bento) Vagrant boxes (bento/debian-13, bento/windows-11, bento/rockylinux-10.2, bento/alpine-3.24, bento/freebsd-15.1, bento/omnios):
vagrant up debian-13 --provider=qemu
vagrant up windows-11 --provider=qemuThe project uses CMake (v3.14+).
| Option | Default | Description |
|---|---|---|
${PROJECT_NAME}_CRT_LINKAGE |
Shared |
MSVC CRT Linkage: Static (/MT) vs Shared (/MD) |
${PROJECT_NAME}_CHARSET |
UNICODE |
Charset: UNICODE vs ANSI |
${PROJECT_NAME}_THREADING |
Multi-threaded |
Threading model |
${PROJECT_NAME}_LTO |
OFF |
Enable Link-Time Optimization |
BUILD_SHARED_LIBS |
OFF |
Build as Shared/Dynamic Library (.dll, .so, .dylib) |
CMN_ENABLE_ASAN |
OFF |
Enable AddressSanitizer (GCC/Clang) |
CMN_ENABLE_UBSAN |
OFF |
Enable UndefinedBehaviorSanitizer (GCC/Clang) |
CMN_ENABLE_COVERAGE |
OFF |
Enable coverage reporting |
mkdir build && cd build
cmake .. -Dcmn_LTO=ON -DCMAKE_BUILD_TYPE=Release
cmake --build .Dependencies are automatically fetched via CMake FetchContent:
Below is a snippet demonstrating application initialization, window creation, responsive Flexbox layout (cmn_flex_t), and router registration.
#include <cmn/app.h>
#include <cmn/error.h>
#include <cmn/layout.h>
#include <cmn/router.h>
#include <cmn/widget.h>
#include <stddef.h>
#include <stdlib.h>
static cmn_error_e run_app(void) {
cmn_app_t *app = NULL;
cmn_window_t *win = NULL;
cmn_flex_t *flex = NULL;
cmn_router_t *router = NULL;
cmn_edges_t pad = {16, 20, 16, 20};
cmn_error_e rc = CMN_SUCCESS;
cmn_error_e cleanup_rc = CMN_SUCCESS;
/* 1. Initialize application */
rc = cmn_app_create(&app);
if (rc != CMN_SUCCESS) {
return rc;
}
/* 2. Create the main window and attach a responsive Flexbox layout */
rc = cmn_window_create(app, &win);
if (rc != CMN_SUCCESS) {
goto cleanup;
}
rc = cmn_window_set_title(win, "Hello cmn");
if (rc != CMN_SUCCESS) {
goto cleanup;
}
rc = cmn_flex_create(&flex);
if (rc != CMN_SUCCESS) {
goto cleanup;
}
rc = cmn_flex_set_direction(flex, CMN_FLEX_COLUMN);
if (rc != CMN_SUCCESS) {
goto cleanup;
}
rc = cmn_flex_set_gap(flex, 12, 12);
if (rc != CMN_SUCCESS) {
goto cleanup;
}
rc = cmn_flex_set_padding(flex, pad);
if (rc != CMN_SUCCESS) {
goto cleanup;
}
rc = cmn_window_set_layout(win, flex);
if (rc != CMN_SUCCESS) {
goto cleanup;
}
/* 3. Initialize routing for the layout container */
rc = cmn_router_create(flex, &router);
if (rc != CMN_SUCCESS) {
goto cleanup;
}
/*
* rc = cmn_router_register(router, "/home", home_view_factory, NULL);
* if (rc != CMN_SUCCESS) {
* goto cleanup;
* }
* rc = cmn_router_navigate(router, "/home");
* if (rc != CMN_SUCCESS) {
* goto cleanup;
* }
*/
/* 4. Show window and run event loop */
rc = cmn_window_show(win);
if (rc != CMN_SUCCESS) {
goto cleanup;
}
rc = cmn_app_run(app);
if (rc != CMN_SUCCESS) {
goto cleanup;
}
cleanup:
/* 5. Cleanup */
if (router != NULL) {
cleanup_rc = cmn_router_destroy(&router);
if (rc == CMN_SUCCESS && cleanup_rc != CMN_SUCCESS) {
rc = cleanup_rc;
}
}
if (flex != NULL) {
cleanup_rc = cmn_flex_destroy(&flex);
if (rc == CMN_SUCCESS && cleanup_rc != CMN_SUCCESS) {
rc = cleanup_rc;
}
}
if (win != NULL) {
cleanup_rc = cmn_window_destroy(&win);
if (rc == CMN_SUCCESS && cleanup_rc != CMN_SUCCESS) {
rc = cleanup_rc;
}
}
if (app != NULL) {
cleanup_rc = cmn_app_destroy(&app);
if (rc == CMN_SUCCESS && cleanup_rc != CMN_SUCCESS) {
rc = cleanup_rc;
}
}
return rc;
}
int main(void) {
return run_app() == CMN_SUCCESS ? EXIT_SUCCESS : EXIT_FAILURE;
}See examples/simple_password_flow for a complete example featuring state management and routing.
This repository (c-multiplatform-native / cmn) is the retained-mode native OS widget framework, whereas c-multiplatform is its sister immediate-mode / custom-rendered UI framework.
Both are written in strict ANSI C (C89/C90), expose zero-overhead C ABIs for universal FFI, provide reactive Signals, forms, routing, and accessibility, and share the exact same underlying C ecosystem (c-orm, c-abstract-http, c-fs, cdd-c, etc.)—which is also shared by c-rest-framework on the backend. This means your business logic, data models, networking, and database persistence code are 100% interchangeable across both UI frameworks and your backend services.
| Dimension | c-multiplatform-native (cmn) |
c-multiplatform |
|---|---|---|
| Rendering Paradigm | Retained-Mode Native OS Widgets | Immediate-Mode / Custom Rendering Engine |
| Under the Hood | Wraps actual OS controls (HWND on Win32, NSView/UIView on Apple, GtkWidget on Linux, Android View, Web DOM) |
Custom GPU/software render paths (OpenGL ES, Direct3D, GDI+, Metal, Wayland/X11, Web Inspectable DOM) + Headless CDK |
| Visual Identity | 100% Authentic OS Look & Feel (automatically adapts to OS version, system themes, and platform conventions) | Pixel-Perfect Cross-Platform Consistency (built-in Material 3, Cupertino, and custom design token themes) |
| Layout System | Native platform layout managers & containers | Full W3C CSS Layout Engine (Flexbox, CSS Grid, CSS Selectors, Transitions) |
| Binary Footprint | Ultra-Minimal (delegates widget drawing, text shaping, and controls to the host OS) | Small (< 2 MB typical static link, bundles layout & rendering engine) |
| Memory & CPU Profile | Event-driven retained state; zero per-frame redraw overhead when idle | Immediate-mode / frame-driven pipeline with hierarchical arenas & object pools |
| Accessibility (a11y) | Inherent via Host OS (screen readers, IME, and OS assistive tools see standard native controls directly) | Synthesized native OS ARIA tree & inspectable DOM |
| Dynamic UI / Ejection | Programmatic C API with reactive Signals binding | Live JSON Schema Interpreter + Ahead-of-Time (AoT) C89 Code Ejection |
| Embedded / Framebuffer | Requires a host OS windowing toolkit | Runs anywhere, including bare-metal / RTOS headless framebuffers (DRM/KMS) |
Choose c-multiplatform-native (cmn) when:
- You want your application to feel indistinguishable from a first-party OS utility on Windows, macOS, Linux, iOS, and Android.
- You want the smallest possible binary size and lowest idle memory/battery consumption by offloading rendering and text shaping to the operating system.
- You rely heavily on standard OS behaviors out of the box (native context menus, system font rendering, platform-native file pickers, IME input, and OS-level screen readers).
- You are building desktop/mobile utilities, system tray apps, enterprise forms, configuration tools, or native wrappers.
Choose c-multiplatform when:
- You need pixel-identical branding and custom styling across every platform (e.g., Material 3 design language or bespoke brand themes).
- You want a full W3C CSS layout engine (Flexbox, Grid, CSS transitions) or need custom-drawn animations, canvases, and high-frequency immediate-mode rendering.
- You are targeting headless/embedded framebuffers (RTOS, DRM/KMS) where no desktop toolkit (Win32/Cocoa/GTK) exists.
- You need server-driven / runtime-defined UIs via JSON schemas with Ahead-of-Time (AoT) C89 code ejection.
c-multiplatform-native is part of a cohesive full-stack ecosystem of strict ANSI C (C89/C90) libraries:
- Frontend (Native OS Widgets):
c-multiplatform-native(cmn) - Frontend (Immediate-Mode / W3C CSS):
c-multiplatform - Backend (REST API & Services):
c-rest-framework
All three frameworks reuse the exact same foundational libraries—c-orm, c-abstract-http, c-fs, cdd-c, c-str-span, and c89stringutils. You can switch UI paradigms between c-multiplatform-native and c-multiplatform—or share schemas, ORM models, validation, HTTP clients, and filesystem logic directly between your GUI client and your c-rest-framework backend—without rewriting a single line of domain code:
flowchart TD
classDef default fill:none,stroke:#888,stroke-width:1px;
CMN["c-multiplatform-native (Native Widgets)"]
CMP["c-multiplatform (Immediate Mode / CSS)"]
CRF["c-rest-framework (Backend / REST API)"]
HTTP["c-abstract-http"]
FS["c-fs"]
ORM["c-orm"]
CDD["cdd-c"]
CI["c-ci"]
UTILS["c89stringutils"]
SPAN["c-str-span"]
CMN --> HTTP
CMN --> FS
CMN --> ORM
CMN --> CDD
CMP --> HTTP
CMP --> FS
CMP --> ORM
CMP --> CDD
CRF --> HTTP
CRF --> FS
CRF --> ORM
CRF --> CDD
HTTP --> UTILS
FS --> UTILS
ORM --> SPAN
| Library / Framework | Role in the Ecosystem | CI Shield |
|---|---|---|
| c-multiplatform-native | Retained-mode cross-platform GUI framework wrapping native OS widgets (Win32, Cocoa, GTK, UIKit, Android, Web DOM). | |
| c-multiplatform | Immediate-mode / custom-rendered GUI framework in ANSI C with a full W3C CSS layout engine, Headless CDK, and Material 3 support. | |
| c-rest-framework | Full-featured C REST backend framework that reuses c-orm, c-abstract-http, c-fs, cdd-c, etc.—native on Windows, Linux, macOS, BSD, DOS, and Cygwin. |
|
| c-orm | Portable C ORM (PostgreSQL, SQLite, MySQL) with Alembic/Diesel-style migrations—shared between c-rest-framework on the server and cmn/room.h on the client. |
|
| c-abstract-http | Cross-platform HTTP/HTTPS interface reusing native OS stacks (WinHTTP/WinINet, Apple CommonCrypto/NSURLSession, Android, libsoup) with libcurl fallback. | |
| c-fs | std::filesystem-inspired portable file and directory abstraction for C89/C90 across Windows, macOS, Linux, and legacy toolchains. |
|
| cdd-c | Compiler-Driven Development utilities, schema/model code generation, and OpenAPI/C tooling shared across frontend and backend. | |
| c-ci | Cross-platform CMake CI, dependency orchestration, and testing infrastructure. | |
| c-str-span | Zero-copy UTF-8 string spans (non-null-terminated) used across the ORM, HTTP, and UI layers. | |
| c89stringutils | Safe string formatting and manipulation functions from newer standards backported to strict C89/C90. |
While C++ and Rust are dominant in modern systems programming, strict C90 provides unparalleled ABI stability, zero-overhead FFI compatibility with higher-level languages (Python, Go, Node.js, Rust, C#, Swift), and fast compilation times. C90 ensures that the library can be integrated anywhere, from deeply embedded systems to massive legacy codebases, without requiring specialized toolchains.
- libui: A C library for native GUI, but lacking in modern SPA routing paradigms, reactive signals, integrated ORM/HTTP ecosystem libraries, and deep automation testing primitives out-of-the-box.
- Qt / wxWidgets: Massive C++ frameworks that come with a large footprint and complex build dependencies.
cmnaims to stay lightweight and C-ABI first. - GTK: A robust C library, but heavily tied to the GNOME ecosystem and requires bundling significant runtime dependencies on non-Linux platforms.
cmnwraps native OS APIs directly on each platform (Win32 on Windows, Cocoa on macOS, UIKit on iOS, etc.). - React Native / Electron: Heavy web-based or bridged VM overhead.
cmntakes the developer ergonomics of reactive frameworks (Signals, Routers, Forms) and applies them to native binaries with a fraction of the footprint.
Contributions are welcome! Please ensure that any PRs maintain C90 compliance, include relevant unit tests under tests/, and compile warning-free across MSVC, GCC, and Clang.
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.































































































