Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

Fix some linker errors to do with C++ vs C compilation #49

Merged
merged 9 commits into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ path = "wasmer.rs"
[dependencies.wasmer-c-api]
version = "2.0.0"
default-features = false
features = ["jit", "cranelift", "wasi"]
features = ["jit", "cranelift", "wasi", "universal"]
4 changes: 2 additions & 2 deletions bin/finalizers.cc → bin/finalizers.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#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) { \
void wasm_##type##_delete(void *native_object); \
void wasm_##type##_finalizer(void *unused, void *native_object) { \
wasm_##type##_delete(native_object); \
} \
DART_EXPORT void set_finalizer_for_##type(Dart_Handle dart_object, \
Expand Down
8 changes: 3 additions & 5 deletions bin/setup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ Future<void> _main(ArgResults args) async {
'--release'
],
environment: {
if (args['clang'] != null) 'CC': clang,
if (args['clangpp'] != null) ...{
'CC': clangpp,
'CXX': clangpp,
'LINKER': clangpp,
'CARGO_TARGET_${_toUpperUnderscore(target)}_LINKER': clangpp,
Expand Down Expand Up @@ -321,22 +321,20 @@ Future<void> _main(ArgResults args) async {
]);

// Build finalizers.o.
await _run(clangpp, [
await _run(clang, [
'-DDART_SHARED_LIB',
'-DNDEBUG',
'-fno-exceptions',
'-fno-rtti',
if (os != 'windows') '-fPIC',
'-O3',
'-std=c++11',
'-target',
target,
'-I',
sdkIncDir.toFilePath(),
'-I',
outDir.resolve('include/').toFilePath(),
'-c',
srcDir.resolve('finalizers.cc').toFilePath(),
srcDir.resolve('finalizers.c').toFilePath(),
'-o',
outDir.resolve('finalizers.o').toFilePath()
]);
Expand Down