Skip to main content

Function: wrapPtr()

wrapPtr<T>(ptr, cls): T

Defined in: packages/ffi/src/native.ts:30

Wraps a native pointer in a class instance without calling the constructor. Used when receiving pointers from FFI calls that need to be wrapped as TypeScript objects.

Type Parameters

Type Parameter
T extends object

Parameters

ParameterTypeDescription
ptrunknownThe native pointer to wrap
cls{ prototype: T; }The class whose prototype should be used
cls.prototypeT-

Returns

T

A new instance with the pointer attached