Skip to content

Make TypeArray deref into slices? #3806

Closed Answered by daxpedda
DexterHill0 asked this question in Q&A
Discussion options

You must be logged in to vote

Unfortunately this is technically not possible. An ArrayBuffer represents external memory that can't be represented in pointers to the internal memory in Wasm (I don't believe the multi-memory proposal can fill that gap as well).

The solution is to accept a Uint8Array instead of an &[u8] to avoid having to copy everything into the Wasm memory, as long as that fits your requirements.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@DexterHill0
Comment options

@daxpedda
Comment options

@DexterHill0
Comment options

@daxpedda
Comment options

@DexterHill0
Comment options

Answer selected by DexterHill0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #3805 on January 22, 2024 09:38.