Move Wasmtime for .NET to the Wasmtime repo.

This moves the Wasmtime for .NET implementation to the Wasmtime repo.

Wasmtime for .NET is a binding of the Wasmtime API for use in .NET.
This commit is contained in:
Peter Huene
2019-11-22 17:11:00 -08:00
parent bbe2a797ba
commit 9fdf5bce8e
100 changed files with 6391 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
using System;
using System.Runtime.InteropServices;
namespace Wasmtime.Imports
{
/// <summary>
/// The base class for import types.
/// </summary>
public abstract class Import
{
internal Import(IntPtr importType)
{
unsafe
{
var moduleName = Interop.wasm_importtype_module(importType);
ModuleName = Marshal.PtrToStringUTF8((IntPtr)moduleName->data, (int)moduleName->size);
var name = Interop.wasm_importtype_name(importType);
Name = Marshal.PtrToStringUTF8((IntPtr)name->data, (int)name->size);
}
}
/// <summary>
/// The module name of the import.
/// </summary>
public string ModuleName { get; private set; }
/// <summary>
/// The name of the import.
/// </summary>
public string Name { get; private set; }
/// <inheritdoc/>
public override string ToString()
{
return $"{ModuleName}{(string.IsNullOrEmpty(ModuleName) ? "" : ".")}{Name}";
}
}
}