Wasmtime
wasmtime::ExternRef Class Reference

Representation of a WebAssembly externref value. More...

#include <_externref_class.hh>

Public Member Functions

 ExternRef (Store::Context cx, std::any val)
 
std::any & data (Store::Context cx)
 Returns the underlying host data associated with this ExternRef.
 

Detailed Description

Representation of a WebAssembly externref value.

This class represents an value that cannot be forged by WebAssembly itself. All ExternRef values are guaranteed to be created by the host and its embedding. It's suitable to place private data structures in here which WebAssembly will not have access to, only other host functions will have access to them.

Note that ExternRef values are rooted within a Store and must be manually unrooted via the unroot function. If this is not used then values will never be candidates for garbage collection.

Constructor & Destructor Documentation

◆ ExternRef()

wasmtime::ExternRef::ExternRef ( Store::Context  cx,
std::any  val 
)
inlineexplicit

Creates a new externref value from the provided argument.

Note that val should be safe to send across threads and should own any memory that it points to. Also note that ExternRef is similar to a std::shared_ptr in that there can be many references to the same value.


The documentation for this class was generated from the following file: