d0e1be5c99
This replaces third_party/wasmer and the related build rules, so I'll delete that stuff once the package is published. Bug: https://github.com/dart-lang/sdk/issues/37882 Change-Id: I33728e42c734bc8c25a2d32522112f2a3dbf4384 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180446 Commit-Queue: Liam Appelbe <liama@google.com> Reviewed-by: Siva Annamalai <asiva@google.com>
27 lines
1.1 KiB
C++
27 lines
1.1 KiB
C++
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#include "include/dart_api.h"
|
|
#include "include/dart_api_dl.h"
|
|
|
|
#define FINALIZER(type) \
|
|
extern "C" void wasm_##type##_delete(void*); \
|
|
extern "C" void wasm_##type##_finalizer(void*, void* native_object) { \
|
|
wasm_##type##_delete(native_object); \
|
|
} \
|
|
DART_EXPORT void set_finalizer_for_##type(Dart_Handle dart_object, \
|
|
void* native_object) { \
|
|
Dart_NewFinalizableHandle_DL(dart_object, native_object, 0, \
|
|
wasm_##type##_finalizer); \
|
|
}
|
|
|
|
FINALIZER(engine);
|
|
FINALIZER(store);
|
|
FINALIZER(module);
|
|
FINALIZER(instance);
|
|
FINALIZER(trap);
|
|
FINALIZER(memorytype);
|
|
FINALIZER(memory);
|
|
FINALIZER(func);
|