Table of Contents

Class OwnedBuffer

Namespace
Pamoja.Native.Interop
Assembly
Pamoja.Native.dll

Byte buffers a native call hands back for the caller to own.

public static class OwnedBuffer
Inheritance
OwnedBuffer
Inherited Members

Remarks

Several native calls return a length-prefixed buffer rather than writing into a span, because the length is not known until the call returns. The handle owns native memory, so it has to be released whether the copy succeeds or throws.

Methods

Take(nint)

Copies a native byte buffer out and releases it.

public static byte[] Take(nint buffer)

Parameters

buffer nint

The buffer handle a native call produced.

Returns

byte[]

The buffer's contents.