|
Deki 1.3.0
Modular C++ 2D engine for embedded displays and desktop
|
Layout fingerprint of the reflection structs that cross DLL boundaries. More...
#include <DekiReflectionAbi.h>
Public Attributes | |
| uint32_t | version |
| uint32_t | sizeofPropertyInfo |
| uint32_t | sizeofComponentMeta |
| uint32_t | sizeofFieldRef |
| uint32_t | sizeofDekiObject |
| uint32_t | sizeofDekiComponent |
Layout fingerprint of the reflection structs that cross DLL boundaries.
A package DLL builds its own property tables as static arrays and hands the editor a pointer plus a count. The editor then walks them with ITS compiled sizeof, so the two sides must agree on the layout exactly. They usually do, because everything is rebuilt together, and when they don't the failure is vicious: appending a field to DekiPropertyInfo changes the array STRIDE, so element 0 reads fine and every element after it lands mid-struct. A const char* read out of the middle of a struct is non-null garbage, so it sails past null checks and faults far away (seen as a crash inside strlen, several frames deep in JSON key lookup, during scene compilation).
The append-only rule the metadata structs document protects a SINGLE struct read through a pointer: a stale reader finds the fields it knows at the right offsets and ignores the rest. It does not protect an ARRAY, because the stride changes. So arrays of these structs need a real handshake, which is this.
Every package DLL exports its compiled values (DekiPackageAbi.cpp, linked into each package by BuildFileGenerator) and the loader refuses a package that disagrees, naming it and saying to rebuild. Loudly wrong beats silently corrupt.
LIMIT: this catches size changes, not same-size reorderings. Bump kDekiReflectionAbiVersion by hand when you move a field without changing the struct's size, so old packages are still rejected.
| uint32_t DekiReflectionAbi::version |
| uint32_t DekiReflectionAbi::sizeofPropertyInfo |
| uint32_t DekiReflectionAbi::sizeofComponentMeta |
| uint32_t DekiReflectionAbi::sizeofFieldRef |
| uint32_t DekiReflectionAbi::sizeofDekiObject |
| uint32_t DekiReflectionAbi::sizeofDekiComponent |