Arrays, strings, and callbacks in generated .NET bindings
Documentation status: architecture — see Maturity and evidence.
The generated binding should present ordinary managed values while preserving the ABI ownership and element-type contracts underneath.
Strings
Published strings are projected as managed string values. The generated native ABI contract uses UTF-8 at the boundary. Input string storage is caller-owned for the duration of the call; returned/out string storage is copied by the client side and released through the module's ABI release/free mechanism.
Application code should not own native UTF-8 pointers directly.
Arrays
Array publication retains the element type. The native generated wrapper uses explicit array metadata and element-aware conversion paths rather than treating every array as an opaque byte buffer.
The generator rejects array chains containing record layouts that are not ABI-flat. This prevents a target binding from receiving an array whose element representation cannot be reconstructed safely.
At the managed layer, the intended projection is a typed array or another generated typed collection appropriate to the binding:
Concept[] candidates = service.FindCandidates(query);
Nested allocation/release behavior remains capability-specific and should be validated for the binding/runtime release being used.
Object arrays
Arrays of published objects carry Runtime references for each element. The binding must convert those references into managed wrappers while preserving the ownership policy of the returned collection and its elements.
Callbacks
The publication model can describe callback/procedure signatures when their parameter and result types are themselves publishable. Method-reference forms that require an unsupported object/trampoline representation are deliberately rejected.
A generated .NET callback therefore needs an explicit managed delegate projection and a lifetime rule that keeps the delegate reachable for as long as native code may call it.
Cross-RPC callback parity is not yet documented as a general reference guarantee. Treat callback support as capability-dependent until the generated contract test suite certifies the concrete adapter.