1#ifndef WASMTIME_EXTERNREF_CLASS_HH
2#define WASMTIME_EXTERNREF_CLASS_HH
6#ifdef WASMTIME_FEATURE_GC
8#include <wasmtime/_store_class.hh>
10#include <wasmtime/helpers.hh>
31 static void finalizer(
void *ptr) {
32 std::unique_ptr<std::any> _ptr(
static_cast<std::any *
>(ptr));
42 void *ptr = std::make_unique<std::any>(val).release();
45 fprintf(stderr,
"failed to allocate a new externref");
Representation of a WebAssembly externref value.
Definition: _externref_class.hh:27
ExternRef(Store::Context cx, std::any val)
Definition: _externref_class.hh:41
std::any & data(Store::Context cx)
Returns the underlying host data associated with this ExternRef.
Definition: _externref_class.hh:51
An interior pointer into a Store.
Definition: _store_class.hh:65
const wasmtime_context_t * capi() const
Returns the underlying C API pointer.
Definition: _store_class.hh:183
Build-time defines for how the C API was built.
WASM_API_EXTERN bool wasmtime_externref_new(wasmtime_context_t *context, void *data, void(*finalizer)(void *), wasmtime_externref_t *out)
Create a new externref value.
WASM_API_EXTERN void * wasmtime_externref_data(wasmtime_context_t *context, const wasmtime_externref_t *data)
Get an externref's wrapped data.
A host-defined un-forgeable reference to pass into WebAssembly.
Definition: val.h:136