Deki 1.3.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches
DekiReflectionAbi.h File Reference

Classes

struct  DekiReflectionAbi
 Layout fingerprint of the reflection structs that cross DLL boundaries. More...

Macros

#define DEKI_REFLECTION_ABI_EXPORT_NAME   "DekiPlugin_GetReflectionAbi"

Typedefs

typedef const DekiReflectionAbi *(*) DekiGetReflectionAbiFunc()

Functions

DekiReflectionAbi DekiCurrentReflectionAbi ()
 The values as compiled into whoever calls this.
bool DekiReflectionAbiMatches (const DekiReflectionAbi &other, char *what, size_t whatSize)
 Compare a loaded DLL's values against ours.

Variables

constexpr uint32_t kDekiReflectionAbiVersion = 5
 Bump ONLY for a layout change that keeps every sizeof identical (reordering or repurposing a field).

Macro Definition Documentation

◆ DEKI_REFLECTION_ABI_EXPORT_NAME

#define DEKI_REFLECTION_ABI_EXPORT_NAME   "DekiPlugin_GetReflectionAbi"

Typedef Documentation

◆ DekiGetReflectionAbiFunc

typedef const DekiReflectionAbi *(*) DekiGetReflectionAbiFunc()

Function Documentation

◆ DekiCurrentReflectionAbi()

DekiReflectionAbi DekiCurrentReflectionAbi ( )
inline

The values as compiled into whoever calls this.

◆ DekiReflectionAbiMatches()

bool DekiReflectionAbiMatches ( const DekiReflectionAbi & other,
char * what,
size_t whatSize )
inline

Compare a loaded DLL's values against ours.

Parameters
whatBuffer receiving a description of the FIRST mismatch (for the log).
Returns
true when the layouts match and the DLL is safe to use.

Variable Documentation

◆ kDekiReflectionAbiVersion

uint32_t kDekiReflectionAbiVersion = 5
inlineconstexpr

Bump ONLY for a layout change that keeps every sizeof identical (reordering or repurposing a field).

Size changes are caught anyway.

2: dropped sizeofNodeMeta. DekiNodeMeta moved out of the engine into the deki-nodegraph package, and the engine must not include a package header to build its own ABI fingerprint. That guard now lives where the struct does: NodeTypeRegistry::Register takes the caller's compiled sizeof through a default argument and refuses a meta that disagrees. This field shrinking is itself a layout change, hence the bump — version sits at offset 0 in both the old and new struct, so a pre-bump DLL is rejected on it.

3: added sizeofDekiObject and sizeofDekiComponent. Until now the handshake covered only the reflection tables, while packages were also reading DekiObject's members through inline accessors with nothing checking that layout at all. Growing the struct is itself a layout change, so the bump is required: a version-2 DLL returns a shorter struct, and reading the two new fields out of it would read past its end. The loader must therefore check version THROUGH THE POINTER before copying the struct by value.

4: dropped the deprecated getType()/getBaseType() forwarders. The struct is unchanged and every sizeof still matches, so nothing else here would catch a package built against v3 – it would reference a spelling that no longer exists. This is exactly the layout-compatible but semantically incompatible case this counter exists for: bump it so such a package is refused at load rather than failing in a confusing way later.

5: added the DekiComponent::DeclaresUpdate() virtual. Every sizeof is unchanged, but a slot was inserted in the middle of the component vtable, so a package built against v4 calls the wrong function through every virtual after it (seen as an integer divide by zero deep inside a stale plugin while compiling a scene). The vtable is part of the ABI even though nothing here can measure it: any new virtual on DekiComponent or DekiBehaviour needs a bump.

(no bump) DekiPropertyInfo grew renamedFrom (DEKI_RENAMED_FROM). The struct's size changed, which sizeofPropertyInfo catches on its own: a package built before it is refused and rebuilt.