In theory it’s nice, but the core cap’n’proto library is too large for many embedded devices. It seems to be full of dynamic features making it difficult to pair down.
Have you tried using link-time garbage collection? The library is designed in a layered way, such that the core serialization does not depend on the "dynamic" features, so if you don't ever call "dynamic" features then link-time GC should be able to drop a huge chunk of the lib.
There's also "lite mode", which #ifdef's out all the dynamic stuff:
./configure --disable-reflection
Although it isn't as aggressive as it could be. We should fix that. I filed an issue:
No I didn’t but that’s good to know. I tried a few attempts but wasn’t sure about how integral the reflection portions were (or if exceptions were crucial). I’d likely just compiled the library on my dev machine and looked at the library size and tried a few flags to get a quick idea if it’d work.
It’d be useful to be able to just use the serialization protocol. Currently I’m using MsgPack which works decently well to get data from embedded cores but I’d prefer typed structures. Thanks for the feedback!
Although KJ style prefers exceptions, the library is carefully written (and tested) to work with -fno-exceptions. KJ_ASSERT/KJ_REQUIRE invocations (which normally throw exceptions) can define a fallback path to use in the case that exceptions are disabled, usually involving returning some sort of dummy value. You can also register a per-thread exception callback which will be called on all exceptions before the fallback starts (or before aborting, if there is no fallback).