Skip to main content

NativeFunction Class

Namespace: GHIElectronics.TinyCLR.RuntimeLoadableProcedures · Assembly: GHIElectronics.TinyCLR.RuntimeLoadableProcedures

Wraps a native function located at a known address. The first call to Invoke fixes the argument count and types; subsequent calls must match. Supported argument types: 8/16/32/64-bit integers (signed and unsigned), float, double, bool, and arrays of those types.

public sealed class NativeFunction : IDisposable

Constructors

NativeFunction(uint address)

public NativeFunction(uint address)

Constructs a NativeFunction pointing at the given address.

ParameterTypeDescription
addressuint

Methods

Dispose()

public void Dispose()

Releases interop resources associated with this function.

Invoke(params object[] arguments)

public int Invoke(params object[] arguments)

Calls the native function with the given arguments and returns its 32-bit return value. The first invocation locks the argument count; subsequent calls must pass the same number of arguments.

ParameterTypeDescription
argumentsparams object[]Arguments to pass. Supported types: integer (any width, signed or unsigned), float, double, bool, and arrays of those.

Returns int — The function's int return value.