Skip to content
EN FR

Generated arrays

Documentation status: architecture — see Maturity and evidence.

The current publication generators already understand arrays as a first-class public type family. This is stronger than merely listing array in an ABI manifest: the native wrapper generator emits array headers and conversion code, while the C# and Python generators retain array element type information.

Native generated layout

The generated native wrapper uses a compact array header conceptually equivalent to:

ArrayHeader
  Count : native integer
  Items : pointer

The generator builds different payloads according to element kind:

  • primitive numeric and character arrays use contiguous copied element storage;
  • object/interface/pointer arrays use arrays of opaque handles/pointers;
  • string arrays use arrays of separately allocated UTF-8 string pointers;
  • ABI-flat record arrays use contiguous record storage;
  • nested arrays are represented through nested array pointers.

The generator rejects array chains containing record layouts that are not ABI-flat.

Generated language projection

The C# publication model records both the array kind and its element type, and projects fixed/dynamic source arrays to typed T[]-style managed arrays. The Python generator also has dedicated array handling rather than treating arrays as untyped pointers.

Ownership warning

Array result ownership is more complex than a single flat allocation, especially for string arrays and nested arrays. A top-level free is not automatically proof that every nested allocation is reclaimed correctly by every bridge.

For that reason this page remains architecture: array publication and native generation are real, but a single normative ownership/release contract still needs to be certified across generated native, .NET, Python, and RPC paths.

Certification target

Before arrays become a cross-binding reference contract, certify at least:

  • primitive arrays in/out/return;
  • empty and null arrays;
  • object-handle arrays;
  • UTF-8 string arrays and nested release;
  • ABI-flat record arrays;
  • nested arrays;
  • generated .NET round trips;
  • RPC representation and parity with local calls.