Interface: NativePointer
Opaque pointer object. Stores a native void* with full precision.
Null pointers are represented as JavaScript null.
Methods
equals()
equals(
other):boolean
Returns true if both pointers refer to the same address.
Parameters
other
NativePointer | null
Returns
boolean
offset()
offset(
n):NativePointer
Returns a new pointer offset by n bytes.
Parameters
n
number
Returns
NativePointer
toArrayBuffer()
toArrayBuffer(
byteLength,byteOffset?):ExternalArrayBuffer
Like NativePointer.toUint8Array, but returns a zero-copy ExternalArrayBuffer. The same lifetime caveats apply.
Parameters
byteLength
number
byteOffset?
number
Returns
toString()
toString():
string
Returns hex string representation, e.g. "0x7fff5a2b3c00".
Returns
string
toUint8Array()
toUint8Array(
byteLength,byteOffset?):Uint8Array
Returns a zero-copy Uint8Array of byteLength bytes that aliases
the native memory starting at this pointer (plus an optional
byteOffset). No data is copied: reads and writes go straight to the
underlying memory. Its .buffer is an ExternalArrayBuffer, so
the view can be invalidated with view.buffer.detach().
The view does not keep the memory alive and the runtime never frees it. The caller is responsible for ensuring the memory outlives every view over it; accessing a view after the memory has been freed, moved or reallocated is undefined behaviour and can crash the process.
Parameters
byteLength
number
byteOffset?
number
Returns
Uint8Array