Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • 5
    You have a lot of information, but I'm not sure what your question is. Can you clarify? Commented Dec 3, 2024 at 22:41
  • 1
    Unless your data model happens to map directly to an existing serialization system, you're unlikely to find an existing code generator. For your sketch of the data model, arrays will be the tricky part. If these arrays all have statically known sizes, you're matching the C data model (without pointers) and can use existing tooling for creating C bindings. If arrays are encoded in any other way (e.g. prefixed with length), you will likely need a bespoke parser for your data format. I'd probably just write the codegen tool myself. Commented Dec 3, 2024 at 22:52
  • @GregBurghardt My questions are: what are the comparative design costs to rolling this in-house versus using an off-the-shelf serialisation library; and do off-the-shelf frameworks for this kind of thing even exist? Commented Dec 3, 2024 at 23:35
  • 3
    Unless your existing binary format matches a well-known described format, you are unlikely to find an existing library that can replicate your binary format. Commented Dec 4, 2024 at 8:00
  • 1
    Just recently I stumbled across the Apache Kafka wire protocol and the mechanisms by which the reference implementation (in Java) and other language bindings map a (more or less strict) specification into code. I only took a closer look at the Python implementation, but it might be worth looking at the others, too. In the end, you'll likely need to roll your own, but having good examples is almost as good as a finished library. Commented Dec 4, 2024 at 9:09