Skip to content

ffi: introduce NativePointer#854

Merged
saghul merged 1 commit intomasterfrom
ffi-native-pointer
Mar 13, 2026
Merged

ffi: introduce NativePointer#854
saghul merged 1 commit intomasterfrom
ffi-native-pointer

Conversation

@saghul
Copy link
Copy Markdown
Owner

@saghul saghul commented Mar 13, 2026

It's a thin object which stores a native pointer in its opaque field,
similar to Python's PyCapsule: https://docs.python.org/3/c-api/capsule.html

Turns out storing pointers as JS numbers is not that future-proof: #851 (comment)

Thanks @bnoordhuis for the advice!

In addition, introduce a read helper to be able to easily read data
from a pointer a la Bun.

It's a thin object which stores a native pointer in its opaque field,
similar to Python's PyCapsule: https://docs.python.org/3/c-api/capsule.html

Turns out storing pointers as JS numbers is not that future-proof: #851 (comment)

Thanks @bnoordhuis for the advice!

In addition, introduce a `read` helper to be able to easily read data
from a pointer a la Bun.
@saghul saghul force-pushed the ffi-native-pointer branch from db1bfeb to 5196ab8 Compare March 13, 2026 09:39
@saghul saghul merged commit 9124d71 into master Mar 13, 2026
61 of 63 checks passed
@saghul saghul deleted the ffi-native-pointer branch March 13, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant