mpack
FreeA C encoder/decoder for [MessagePack](http://msgpack.com) messages suitable for resource constriants embedded systems. Supports disabling dynamic memory allocation and overriding malloc, free, and realloc.
About mpack
MPack is a C implementation of an encoder and decoder for the MessagePack serialization format, designed to be lightweight, secure, and extremely fast. It provides a buffered reader/writer for streaming data, a tree-style parser that decodes into dynamically typed nodes, and an Expect API for high-performance schema-based parsing. MPack is suitable for resource-constrained embedded systems, supporting compile-time customization to disable dynamic memory allocation and override memory functions. It can be embedded directly into a project via a single-file amalgamation and runs on a wide range of platforms, including 8-bit microcontrollers (e.g., Arduino), WebAssembly, Linux kernel, and all major desktop and mobile OSes. Helper functions enable file I/O, automatic buffer growth, UTF-8 validation, and more.
Key Features
Pros & Cons
- Lightweight and embeddable with a small binary size
- Designed with security in mind against malicious or corrupt data
- Highly portable across diverse platforms and compilers
- Thoroughly documented with code examples and API reference
- Customizable compile-time settings to fit exact requirements
- Dual API (Node and Expect) offers flexibility for different use cases
- Requires manual memory management in constrained environments when disabling dynamic allocation
- Documentation and examples are technical, geared toward C developers
- Limited to MessagePack format; no native JSON or other serialization support
- Learning curve for selecting and using the appropriate API (tree vs. expect)
- May be overkill for simple projects that only need basic serialization