Skip to content
Struct Frame Logo

Struct Frame

Cross-platform code generation from Protocol Buffer definitions

Why Struct Frame

Zero-copy C/C++

Uses packed structs that map directly to memory. No encoding or decoding step required.

Flexible framing

Multiple frame profiles for different scenarios, from zero-overhead trusted links to robust multi-node networks.

Nested messages & arrays

Unlike Mavlink, supports complex message structures with nested messages and variable-length packing for arrays.

Cross-platform

Generate code for embedded C, server Python, and frontend TypeScript from a single proto definition.

Installation

Terminal window
pip install struct-frame

Quick Start

Create a .proto file:

package example;
message Status {
option msgid = 1;
uint32 id = 1;
float value = 2;
}

Generate code:

Terminal window
# Python
python -m struct_frame status.proto --build_py --py_path generated/
# C
python -m struct_frame status.proto --build_c --c_path generated/
# Multiple languages
python -m struct_frame status.proto --build_c --build_py --build_ts

Quick Language Reference

#include "example.structframe.hpp"
// Create a message
ExampleStatus msg;
msg.id = 42;
msg.value = 3.14f;
// No encoding needed - use directly as bytes
uint8_t* data = (uint8_t*)&msg;
size_t size = sizeof(ExampleStatus);