This commit changes the C API function `wasm_module_new` to use the Rust API `Module::from_binary` which performs verification of the module, as per the C API spec. This also introduces a `EngineBuilder` type to the C# API that can be used to construct an `Engine` with the various Wasmtime configuration options. This is required to get the C# tests passing since they use reference types and multi-value. Fixes #859.
47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
using System;
|
|
using System.IO;
|
|
using Wasmtime;
|
|
|
|
namespace Wasmtime.Tests
|
|
{
|
|
public abstract class ModuleFixture : IDisposable
|
|
{
|
|
public ModuleFixture()
|
|
{
|
|
Engine = new EngineBuilder()
|
|
.WithMultiValue(true)
|
|
.WithReferenceTypes(true)
|
|
.Build();
|
|
Store = Engine.CreateStore();
|
|
Module = Store.CreateModule(Path.Combine("Modules", ModuleFileName));
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
if (!(Module is null))
|
|
{
|
|
Module.Dispose();
|
|
Module = null;
|
|
}
|
|
|
|
if (!(Store is null))
|
|
{
|
|
Store.Dispose();
|
|
Store = null;
|
|
}
|
|
|
|
if (!(Engine is null))
|
|
{
|
|
Engine.Dispose();
|
|
Engine = null;
|
|
}
|
|
}
|
|
|
|
public Engine Engine { get; set; }
|
|
public Store Store { get; set; }
|
|
public Module Module { get; set; }
|
|
|
|
protected abstract string ModuleFileName { get; }
|
|
}
|
|
}
|