├── Wasm3DotNetDemo ├── test.wasm ├── App.config ├── test.wat ├── Properties │ └── AssemblyInfo.cs ├── Program.cs └── Wasm3DotNetDemo.csproj ├── .gitmodules ├── Wasm3DotNet ├── Wrapper │ ├── Wasm3Exception.cs │ ├── Environment.cs │ ├── Module.cs │ ├── Runtime.cs │ └── Function.cs ├── M3ValueType.cs ├── M3ErrorInfo.cs ├── IM3Module.cs ├── IM3Function.cs ├── Wasm3DotNet.csproj ├── IM3Runtime.cs ├── IM3Environment.cs ├── ConstantStringMarshaler.cs ├── M3RawCall.cs └── NativeFunctions.cs ├── wasm3_dll ├── wasm3.def ├── wasm3_dll.vcxproj.filters └── wasm3_dll.vcxproj ├── LICENSE ├── README.md ├── .gitattributes ├── Wasm3DotNet.sln └── .gitignore /Wasm3DotNetDemo/test.wasm: -------------------------------------------------------------------------------- 1 | asm `` externals print_addtest 2 | 3 |  A -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "wasm3_dll/wasm3"] 2 | path = wasm3_dll/wasm3 3 | url = https://github.com/wasm3/wasm3.git 4 | -------------------------------------------------------------------------------- /Wasm3DotNetDemo/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Wasm3DotNet/Wrapper/Wasm3Exception.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Wasm3DotNet.Wrapper 6 | { 7 | public class Wasm3Exception : Exception 8 | { 9 | public Wasm3Exception(string message) : base(message) 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Wasm3DotNet/M3ValueType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Wasm3DotNet 6 | { 7 | // Represents value type in WebAssembly. 8 | // Same as M3ValueType enum in wasm3.h. 9 | public enum M3ValueType 10 | { 11 | None = 0, 12 | I32 = 1, 13 | I64 = 2, 14 | F32 = 3, 15 | F64 = 4, 16 | Unknown 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Wasm3DotNet/M3ErrorInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Wasm3DotNet 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | public struct M3ErrorInfo 8 | { 9 | string result; 10 | IM3Runtime runtime; 11 | IM3Module module; 12 | IM3Function function; 13 | string file; 14 | uint line; 15 | string message; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /wasm3_dll/wasm3.def: -------------------------------------------------------------------------------- 1 | LIBRARY wasm3 2 | EXPORTS 3 | m3_NewEnvironment 4 | m3_FreeEnvironment 5 | m3_NewRuntime 6 | m3_FreeRuntime 7 | m3_GetMemory 8 | m3_ParseModule 9 | m3_FreeModule 10 | m3_LoadModule 11 | m3_LinkRawFunction 12 | m3_LinkRawFunctionEx 13 | m3_Yield 14 | m3_FindFunction 15 | m3_GetArgCount 16 | m3_GetRetCount 17 | m3_GetArgType 18 | m3_GetRetType 19 | m3_Call 20 | m3_CallArgv 21 | m3_GetResults 22 | m3_GetErrorInfo 23 | m3_ResetErrorInfo -------------------------------------------------------------------------------- /Wasm3DotNet/IM3Module.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Wasm3DotNet 5 | { 6 | public class IM3Module : SafeHandle 7 | { 8 | IM3Module() 9 | : base(IntPtr.Zero, false) 10 | { 11 | } 12 | 13 | public override bool IsInvalid => handle == IntPtr.Zero; 14 | 15 | protected override bool ReleaseHandle() 16 | { 17 | return true; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Wasm3DotNet/IM3Function.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Wasm3DotNet 5 | { 6 | public class IM3Function : SafeHandle 7 | { 8 | IM3Function() 9 | : base(IntPtr.Zero, false) 10 | { 11 | } 12 | 13 | public override bool IsInvalid => handle == IntPtr.Zero; 14 | 15 | protected override bool ReleaseHandle() 16 | { 17 | return true; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Wasm3DotNetDemo/test.wat: -------------------------------------------------------------------------------- 1 | (module 2 | ;; Written in WebAssembly Text Format (wat) 3 | ;; see: https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format 4 | ;; Please assemble with the following command: 5 | ;; wat2wasm test.wat 6 | (import "externals" "print_add" (func $print_add (param i32 i32) (result i32))) 7 | (export "test" (func $test)) 8 | (func $test (param $x i32) (result i32) 9 | local.get $x 10 | i32.const 1 11 | call $print_add 12 | ) 13 | ) -------------------------------------------------------------------------------- /Wasm3DotNet/Wasm3DotNet.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | true 9 | 10 | 11 | 12 | true 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Wasm3DotNet/Wrapper/Environment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Wasm3DotNet.Wrapper 6 | { 7 | public class Environment : IDisposable 8 | { 9 | internal readonly IM3Environment Handle; 10 | 11 | public Environment() 12 | { 13 | Handle = NativeFunctions.m3_NewEnvironment(); 14 | } 15 | 16 | public void Dispose() 17 | { 18 | Handle.Dispose(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Wasm3DotNet/IM3Runtime.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Wasm3DotNet 5 | { 6 | public class IM3Runtime : SafeHandle 7 | { 8 | IM3Runtime() 9 | : base(IntPtr.Zero, true) 10 | { 11 | } 12 | 13 | public override bool IsInvalid => handle == IntPtr.Zero; 14 | 15 | protected override bool ReleaseHandle() 16 | { 17 | NativeFunctions.m3_FreeRuntime(handle); 18 | 19 | return true; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Wasm3DotNet/IM3Environment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Wasm3DotNet 5 | { 6 | public class IM3Environment : SafeHandle 7 | { 8 | IM3Environment() 9 | : base(IntPtr.Zero, true) 10 | { 11 | } 12 | 13 | public override bool IsInvalid => handle == IntPtr.Zero; 14 | 15 | protected override bool ReleaseHandle() 16 | { 17 | NativeFunctions.m3_FreeEnvironment(handle); 18 | 19 | return true; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Wasm3DotNet/ConstantStringMarshaler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Wasm3DotNet 5 | { 6 | // For Native-to-Managed marshaling only. 7 | class ConstantStringMarshaler : ICustomMarshaler 8 | { 9 | public void CleanUpManagedData(object ManagedObj) 10 | { 11 | } 12 | 13 | public void CleanUpNativeData(IntPtr pNativeData) 14 | { 15 | } 16 | 17 | public int GetNativeDataSize() 18 | { 19 | return IntPtr.Size; 20 | } 21 | 22 | public IntPtr MarshalManagedToNative(object ManagedObj) 23 | { 24 | throw new NotImplementedException(); 25 | } 26 | 27 | public object MarshalNativeToManaged(IntPtr pNativeData) 28 | { 29 | if (pNativeData == IntPtr.Zero) 30 | return null; 31 | else 32 | return Marshal.PtrToStringAnsi(pNativeData); 33 | } 34 | 35 | public static ICustomMarshaler GetInstance(string cookie) => new ConstantStringMarshaler(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Wasm3DotNet/M3RawCall.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace Wasm3DotNet 7 | { 8 | /// 9 | /// Represents a C# function that is called from WASM. 10 | /// Low-level access (like macros in m3_api_defs.h) is needed. 11 | /// 12 | /// Pointer to IM3Runtime (Currently there is no way to convert it into C# IM3Runtime object) 13 | /// Pointer to IM3ImportContext (Currently there is no way to convert it into a C# object) 14 | /// WASM stack for parameters and result 15 | /// 16 | /// IntPtr.Zero should be returned when succeeded. 17 | // The attribute is needed for passing a C# function as a "cdecl" function pointer. 18 | // See: https://blog.sgry.jp/entry/2006/04/22/000000 19 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 20 | public delegate IntPtr M3RawCall(IntPtr runtime, IntPtr ctx, IntPtr sp, IntPtr mem); 21 | } 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Satoshi Tanaka 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Wasm3DotNet 2 | A .NET binding for [wasm3](https://github.com/wasm3/wasm3) WebAssembly interpreter. 3 | 4 | ## Structure 5 | Wasm3DotNet consists of two layers: 6 | - Direct, (almost) one-to-one mapping of `wasm3` C API using P/Invoke ([Wasm3DotNet.NativeFunctions](https://github.com/tana/Wasm3DotNet/blob/master/Wasm3DotNet/NativeFunctions.cs)) 7 | - C#-style, class-based wrapper ([Wasm3DotNet.Wrapper namespace](https://github.com/tana/Wasm3DotNet/tree/master/Wasm3DotNet/Wrapper)) 8 | 9 | ## Building 10 | 1. Open `Wasm3DotNet.sln` in Visual Studio. 11 | 2. Build `wasm3_dll` (native code library) 12 | 3. Build `Wasm3DotNet` (managed code library) 13 | 4. To test the demo application, build and run `Wasm3DotNetDemo`. 14 | 15 | ## Usage 16 | After build, two important files will be generated. 17 | - `wasm3_dll/Debug/wasm3.dll` is the native code library that contains wasm3 interpreter. 18 | - `Wasm3DotNet/bin/Debug/netstandard2.0/Wasm3DotNet.dll` is the managed (.NET) library. 19 | 20 | (These paths are relative to the root of this repository. `Debug` is replaced to `Release` for release build) 21 | 22 | To use Wasm3DotNet for your project, add reference to `Wasm3DotNet.dll`, and copy `wasm3.dll` to executable directory (or native plugin folder for Unity). 23 | -------------------------------------------------------------------------------- /Wasm3DotNetDemo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 6 | // 制御されます。アセンブリに関連付けられている情報を変更するには、 7 | // これらの属性値を変更します。 8 | [assembly: AssemblyTitle("Wasm3DotNetDemo")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Wasm3DotNetDemo")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから 18 | // 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 19 | // その型の ComVisible 属性を true に設定します。 20 | [assembly: ComVisible(false)] 21 | 22 | // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります 23 | [assembly: Guid("a97a1732-519d-4b28-a582-31884cb37f68")] 24 | 25 | // アセンブリのバージョン情報は次の 4 つの値で構成されています: 26 | // 27 | // メジャー バージョン 28 | // マイナー バージョン 29 | // ビルド番号 30 | // リビジョン 31 | // 32 | // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます 33 | // 既定値にすることができます: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Wasm3DotNet/Wrapper/Module.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Wasm3DotNet.Wrapper 6 | { 7 | public class Module 8 | { 9 | public delegate IntPtr LinkableFunction(IntPtr sp, IntPtr mem); 10 | 11 | internal readonly IM3Module Handle; 12 | 13 | // For preventing GC of linked functions 14 | private List linkedRawCalls = new List(); 15 | 16 | internal Module(IM3Module handle) 17 | { 18 | Handle = handle; 19 | } 20 | 21 | /// 22 | /// Make a C# function callable from WebAssembly. 23 | /// The passed delegate is kept alive (not garbage-collected) as long as this Module is alive. 24 | /// 25 | /// Module name of the created WASM function. 26 | /// Name of the created WASM function. 27 | /// Function signature in Wasm3's format. 28 | /// Delegate to the C# function. 29 | public void LinkRawFunction(string moduleName, string functionName, string signature, M3RawCall function) 30 | { 31 | linkedRawCalls.Add(function); 32 | 33 | var result = NativeFunctions.m3_LinkRawFunction(Handle, moduleName, functionName, signature, function); 34 | if (result != null) 35 | { 36 | throw new Wasm3Exception(result); 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Wasm3DotNetDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO; 7 | using System.Runtime.InteropServices; 8 | using Wasm3DotNet.Wrapper; 9 | using Wasm3DotNet; 10 | 11 | namespace Wasm3DotNetDemo 12 | { 13 | class Program 14 | { 15 | static void Main(string[] args) 16 | { 17 | using (var environment = new Wasm3DotNet.Wrapper.Environment()) 18 | using (var runtime = new Runtime(environment)) 19 | { 20 | byte[] wasmData = File.ReadAllBytes(@"../../test.wasm"); 21 | var module = runtime.ParseModule(wasmData); 22 | 23 | runtime.LoadModule(module); 24 | 25 | module.LinkRawFunction("externals", "print_add", "i(ii)", Output); 26 | 27 | var func = runtime.FindFunction("test"); 28 | 29 | var ret = func.Call(10); 30 | Console.WriteLine($"Result: {ret}"); 31 | } 32 | 33 | Console.ReadKey(); 34 | } 35 | 36 | static IntPtr Output(IntPtr runtime, IntPtr ctx, IntPtr sp, IntPtr mem) 37 | { 38 | // Read values from WASM stack. 39 | // See: m3_api_defs.h in wasm3 40 | var x = Marshal.ReadInt32(sp, 8); 41 | var y = Marshal.ReadInt32(sp, 16); 42 | Console.WriteLine($"x={x}, y={y}"); 43 | // Write result to WASM stack. 44 | Marshal.WriteInt32(sp, x + y); 45 | 46 | return IntPtr.Zero; // No error 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Wasm3DotNet/Wrapper/Runtime.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Wasm3DotNet.Wrapper 4 | { 5 | public class Runtime : IDisposable 6 | { 7 | internal readonly IM3Runtime Handle; 8 | 9 | readonly Environment environment; 10 | 11 | public Runtime(Environment environment, uint stackSize = 65536) 12 | { 13 | Handle = NativeFunctions.m3_NewRuntime(environment.Handle, stackSize, IntPtr.Zero); 14 | this.environment = environment; 15 | } 16 | 17 | public void Dispose() 18 | { 19 | Handle.Dispose(); 20 | } 21 | 22 | public Module ParseModule(byte[] wasm) 23 | { 24 | IM3Module moduleHandle; 25 | var result = NativeFunctions.m3_ParseModule(environment.Handle, out moduleHandle, wasm, (uint)wasm.Length); 26 | if (result != null) 27 | { 28 | throw new Wasm3Exception(result); 29 | } 30 | 31 | return new Module(moduleHandle); 32 | } 33 | 34 | public void LoadModule(Module module) 35 | { 36 | var result = NativeFunctions.m3_LoadModule(Handle, module.Handle); 37 | if (result != null) 38 | { 39 | throw new Wasm3Exception(result); 40 | } 41 | } 42 | 43 | public Function FindFunction(string name) 44 | { 45 | IM3Function funcHandle; 46 | var result = NativeFunctions.m3_FindFunction(out funcHandle, Handle, name); 47 | if (result != null) 48 | { 49 | throw new Wasm3Exception(result); 50 | } 51 | 52 | return new Function(funcHandle); 53 | } 54 | 55 | public IntPtr GetMemory(out uint memoryByteSize, uint memoryIndex = 0) 56 | { 57 | if (memoryIndex != 0) throw new Wasm3Exception("Only memory 0 supported currently"); 58 | return NativeFunctions.m3_GetMemory(Handle, out memoryByteSize, memoryIndex); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Wasm3DotNetDemo/Wasm3DotNetDemo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {A97A1732-519D-4B28-A582-31884CB37F68} 8 | Exe 9 | Wasm3DotNetDemo 10 | Wasm3DotNetDemo 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | false 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | {6a2205ce-8225-4660-b65b-27d3da0f1218} 57 | Wasm3DotNet 58 | 59 | 60 | 61 | 62 | wasm3.dll 63 | PreserveNewest 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Wasm3DotNet.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30413.136 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wasm3DotNet", "Wasm3DotNet\Wasm3DotNet.csproj", "{6A2205CE-8225-4660-B65B-27D3DA0F1218}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wasm3DotNetDemo", "Wasm3DotNetDemo\Wasm3DotNetDemo.csproj", "{A97A1732-519D-4B28-A582-31884CB37F68}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wasm3_dll", "wasm3_dll\wasm3_dll.vcxproj", "{2836E529-0BBA-407B-ABA3-50B25F502FBA}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Debug|x64 = Debug|x64 16 | Debug|x86 = Debug|x86 17 | Release|Any CPU = Release|Any CPU 18 | Release|x64 = Release|x64 19 | Release|x86 = Release|x86 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {6A2205CE-8225-4660-B65B-27D3DA0F1218}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {6A2205CE-8225-4660-B65B-27D3DA0F1218}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {6A2205CE-8225-4660-B65B-27D3DA0F1218}.Debug|x64.ActiveCfg = Debug|Any CPU 25 | {6A2205CE-8225-4660-B65B-27D3DA0F1218}.Debug|x64.Build.0 = Debug|Any CPU 26 | {6A2205CE-8225-4660-B65B-27D3DA0F1218}.Debug|x86.ActiveCfg = Debug|Any CPU 27 | {6A2205CE-8225-4660-B65B-27D3DA0F1218}.Debug|x86.Build.0 = Debug|Any CPU 28 | {6A2205CE-8225-4660-B65B-27D3DA0F1218}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {6A2205CE-8225-4660-B65B-27D3DA0F1218}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {6A2205CE-8225-4660-B65B-27D3DA0F1218}.Release|x64.ActiveCfg = Release|Any CPU 31 | {6A2205CE-8225-4660-B65B-27D3DA0F1218}.Release|x64.Build.0 = Release|Any CPU 32 | {6A2205CE-8225-4660-B65B-27D3DA0F1218}.Release|x86.ActiveCfg = Release|Any CPU 33 | {6A2205CE-8225-4660-B65B-27D3DA0F1218}.Release|x86.Build.0 = Release|Any CPU 34 | {A97A1732-519D-4B28-A582-31884CB37F68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {A97A1732-519D-4B28-A582-31884CB37F68}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {A97A1732-519D-4B28-A582-31884CB37F68}.Debug|x64.ActiveCfg = Debug|Any CPU 37 | {A97A1732-519D-4B28-A582-31884CB37F68}.Debug|x64.Build.0 = Debug|Any CPU 38 | {A97A1732-519D-4B28-A582-31884CB37F68}.Debug|x86.ActiveCfg = Debug|Any CPU 39 | {A97A1732-519D-4B28-A582-31884CB37F68}.Debug|x86.Build.0 = Debug|Any CPU 40 | {A97A1732-519D-4B28-A582-31884CB37F68}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {A97A1732-519D-4B28-A582-31884CB37F68}.Release|Any CPU.Build.0 = Release|Any CPU 42 | {A97A1732-519D-4B28-A582-31884CB37F68}.Release|x64.ActiveCfg = Release|Any CPU 43 | {A97A1732-519D-4B28-A582-31884CB37F68}.Release|x64.Build.0 = Release|Any CPU 44 | {A97A1732-519D-4B28-A582-31884CB37F68}.Release|x86.ActiveCfg = Release|Any CPU 45 | {A97A1732-519D-4B28-A582-31884CB37F68}.Release|x86.Build.0 = Release|Any CPU 46 | {2836E529-0BBA-407B-ABA3-50B25F502FBA}.Debug|Any CPU.ActiveCfg = Debug|x64 47 | {2836E529-0BBA-407B-ABA3-50B25F502FBA}.Debug|x64.ActiveCfg = Debug|x64 48 | {2836E529-0BBA-407B-ABA3-50B25F502FBA}.Debug|x64.Build.0 = Debug|x64 49 | {2836E529-0BBA-407B-ABA3-50B25F502FBA}.Debug|x86.ActiveCfg = Debug|Win32 50 | {2836E529-0BBA-407B-ABA3-50B25F502FBA}.Debug|x86.Build.0 = Debug|Win32 51 | {2836E529-0BBA-407B-ABA3-50B25F502FBA}.Release|Any CPU.ActiveCfg = Release|x64 52 | {2836E529-0BBA-407B-ABA3-50B25F502FBA}.Release|x64.ActiveCfg = Release|x64 53 | {2836E529-0BBA-407B-ABA3-50B25F502FBA}.Release|x64.Build.0 = Release|x64 54 | {2836E529-0BBA-407B-ABA3-50B25F502FBA}.Release|x86.ActiveCfg = Release|Win32 55 | {2836E529-0BBA-407B-ABA3-50B25F502FBA}.Release|x86.Build.0 = Release|Win32 56 | EndGlobalSection 57 | GlobalSection(SolutionProperties) = preSolution 58 | HideSolutionNode = FALSE 59 | EndGlobalSection 60 | GlobalSection(ExtensibilityGlobals) = postSolution 61 | SolutionGuid = {70DD275B-24D5-47FE-B7EE-D6C5504C4BF6} 62 | EndGlobalSection 63 | EndGlobal 64 | -------------------------------------------------------------------------------- /Wasm3DotNet/Wrapper/Function.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace Wasm3DotNet.Wrapper 7 | { 8 | public class Function 9 | { 10 | internal IM3Function Handle; 11 | public readonly int ArgCount; 12 | public readonly int RetCount; 13 | 14 | internal Function(IM3Function handle) 15 | { 16 | Handle = handle; 17 | 18 | ArgCount = (int)NativeFunctions.m3_GetArgCount(Handle); 19 | RetCount = (int)NativeFunctions.m3_GetRetCount(Handle); 20 | } 21 | 22 | public unsafe object[] CallMultiValue(params object[] args) 23 | { 24 | // Check number of arguments 25 | if (args.Length != ArgCount) 26 | { 27 | throw new ArgumentException($"Wrong number of arguments: expected ${ArgCount}, but got ${args.Length}"); 28 | } 29 | 30 | const int bytesPerValue = 8; 31 | 32 | var argPtrs = new IntPtr[ArgCount]; 33 | // Allocate a buffer to store arguments 34 | var buf = stackalloc byte[bytesPerValue * ArgCount]; 35 | 36 | for (int i = 0; i < ArgCount; i++) 37 | { 38 | var ptr = buf + bytesPerValue * i; 39 | switch (args[i]) 40 | { 41 | case int intArg: 42 | *(int*)ptr = intArg; 43 | break; 44 | case long longArg: 45 | *(long*)ptr = longArg; 46 | break; 47 | case float floatArg: 48 | *(float*)ptr = floatArg; 49 | break; 50 | case double doubleArg: 51 | *(double*)ptr = doubleArg; 52 | break; 53 | default: 54 | throw new ArgumentException($"Argument #{i} has unsupported type: {args[i].GetType()}"); 55 | } 56 | argPtrs[i] = (IntPtr)ptr; 57 | } 58 | 59 | var result = NativeFunctions.m3_Call(Handle, (uint)ArgCount, argPtrs); 60 | if (result != null) 61 | { 62 | throw new Wasm3Exception(result); 63 | } 64 | 65 | // Allocate a buffer to store returned values 66 | var retBuf = stackalloc byte[bytesPerValue * RetCount]; 67 | var retPtrs = new IntPtr[RetCount]; 68 | for (int i = 0; i < RetCount; i++) 69 | { 70 | retPtrs[i] = (IntPtr)(retBuf + bytesPerValue * i); 71 | } 72 | 73 | // Retrieve returned values 74 | result = NativeFunctions.m3_GetResults(Handle, (uint)RetCount, retPtrs); 75 | if (result != null) 76 | { 77 | throw new Wasm3Exception(result); 78 | } 79 | 80 | var returns = new object[RetCount]; 81 | for (int i = 0; i < RetCount; i++) 82 | { 83 | var ptr = retPtrs[i]; 84 | var retType = NativeFunctions.m3_GetRetType(Handle, (uint)i); 85 | switch (retType) 86 | { 87 | case M3ValueType.I32: 88 | returns[i] = *(int*)ptr; 89 | break; 90 | case M3ValueType.I64: 91 | returns[i] = *(long*)ptr; 92 | break; 93 | case M3ValueType.F32: 94 | returns[i] = *(float*)ptr; 95 | break; 96 | case M3ValueType.F64: 97 | returns[i] = *(double*)ptr; 98 | break; 99 | default: 100 | throw new NotImplementedException($"Unknown return type: {retType}"); 101 | } 102 | } 103 | 104 | return returns; 105 | } 106 | 107 | public object Call(params object[] args) 108 | { 109 | var returns = CallMultiValue(args); 110 | return (returns.Length >= 1) ? returns[0] : null; 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /Wasm3DotNet/NativeFunctions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Wasm3DotNet 5 | { 6 | public class NativeFunctions 7 | { 8 | // CallingConvention.Cdecl is needed to avoid "Stack Imbalance" error 9 | // See: https://blog.janjan.net/2017/08/08/csharp-pinvoke-stackimbalance/ 10 | 11 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 12 | public static extern IM3Environment m3_NewEnvironment(); 13 | 14 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 15 | public static extern void m3_FreeEnvironment(IM3Environment environment); 16 | 17 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 18 | internal static extern void m3_FreeEnvironment(IntPtr environment); 19 | 20 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 21 | public static extern IM3Runtime m3_NewRuntime(IM3Environment enviroment, uint stackSizeInBytes, IntPtr unused); 22 | 23 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 24 | public static extern void m3_FreeRuntime(IM3Runtime runtime); 25 | 26 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 27 | internal static extern void m3_FreeRuntime(IntPtr runtime); 28 | 29 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 30 | public static extern IntPtr m3_GetMemory(IM3Runtime runtime, out uint memorySizeInBytes, uint memoryIndex); 31 | 32 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 33 | [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ConstantStringMarshaler))] 34 | public static extern string m3_ParseModule(IM3Environment environment, out IM3Module module, byte[] wasmBytes, uint numWasmBytes); 35 | 36 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 37 | public static extern void m3_FreeModule(IM3Module module); 38 | 39 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 40 | [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ConstantStringMarshaler))] 41 | public static extern string m3_LoadModule(IM3Runtime runtime, IM3Module module); 42 | 43 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 44 | [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ConstantStringMarshaler))] 45 | public static extern string m3_LinkRawFunction(IM3Module module, string moduleName, string functionName, string signature, M3RawCall function); 46 | 47 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 48 | [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ConstantStringMarshaler))] 49 | public static extern string m3_Yield(); 50 | 51 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 52 | [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ConstantStringMarshaler))] 53 | public static extern string m3_FindFunction(out IM3Function function, IM3Runtime runtime, string functionName); 54 | 55 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 56 | public static extern uint m3_GetArgCount(IM3Function function); 57 | 58 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 59 | public static extern uint m3_GetRetCount(IM3Function function); 60 | 61 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 62 | public static extern M3ValueType m3_GetArgType(IM3Function function, uint index); 63 | 64 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 65 | public static extern M3ValueType m3_GetRetType(IM3Function function, uint index); 66 | 67 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 68 | [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ConstantStringMarshaler))] 69 | public static extern string m3_Call(IM3Function function, uint argc, IntPtr[] argPtrs); 70 | 71 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 72 | [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ConstantStringMarshaler))] 73 | public static extern string m3_CallArgv(IM3Function function, uint argc, string[] argv); 74 | 75 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 76 | [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ConstantStringMarshaler))] 77 | public static extern string m3_GetResults(IM3Function function, uint retc, IntPtr[] retPtrs); 78 | 79 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 80 | public static extern void m3_GetErrorInfo(IM3Runtime runtime, out M3ErrorInfo info); 81 | 82 | [DllImport("wasm3", CallingConvention = CallingConvention.Cdecl)] 83 | public static extern void m3_ResetErrorInfo(IM3Runtime runtime); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /wasm3_dll/wasm3_dll.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | ヘッダー ファイル 20 | 21 | 22 | ヘッダー ファイル 23 | 24 | 25 | ヘッダー ファイル 26 | 27 | 28 | ヘッダー ファイル 29 | 30 | 31 | ヘッダー ファイル 32 | 33 | 34 | ヘッダー ファイル 35 | 36 | 37 | ヘッダー ファイル 38 | 39 | 40 | ヘッダー ファイル 41 | 42 | 43 | ヘッダー ファイル 44 | 45 | 46 | ヘッダー ファイル 47 | 48 | 49 | ヘッダー ファイル 50 | 51 | 52 | ヘッダー ファイル 53 | 54 | 55 | ヘッダー ファイル 56 | 57 | 58 | ヘッダー ファイル 59 | 60 | 61 | ヘッダー ファイル 62 | 63 | 64 | ヘッダー ファイル 65 | 66 | 67 | ヘッダー ファイル 68 | 69 | 70 | ヘッダー ファイル 71 | 72 | 73 | ヘッダー ファイル 74 | 75 | 76 | 77 | 78 | ソース ファイル 79 | 80 | 81 | ソース ファイル 82 | 83 | 84 | ソース ファイル 85 | 86 | 87 | ソース ファイル 88 | 89 | 90 | ソース ファイル 91 | 92 | 93 | ソース ファイル 94 | 95 | 96 | ソース ファイル 97 | 98 | 99 | ソース ファイル 100 | 101 | 102 | ソース ファイル 103 | 104 | 105 | ソース ファイル 106 | 107 | 108 | ソース ファイル 109 | 110 | 111 | ソース ファイル 112 | 113 | 114 | ソース ファイル 115 | 116 | 117 | ソース ファイル 118 | 119 | 120 | ソース ファイル 121 | 122 | 123 | ソース ファイル 124 | 125 | 126 | ソース ファイル 127 | 128 | 129 | 130 | 131 | ソース ファイル 132 | 133 | 134 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | [Aa][Rr][Mm]/ 24 | [Aa][Rr][Mm]64/ 25 | bld/ 26 | [Bb]in/ 27 | [Oo]bj/ 28 | [Ll]og/ 29 | 30 | # Visual Studio 2015/2017 cache/options directory 31 | .vs/ 32 | # Uncomment if you have tasks that create the project's static files in wwwroot 33 | #wwwroot/ 34 | 35 | # Visual Studio 2017 auto generated files 36 | Generated\ Files/ 37 | 38 | # MSTest test Results 39 | [Tt]est[Rr]esult*/ 40 | [Bb]uild[Ll]og.* 41 | 42 | # NUNIT 43 | *.VisualState.xml 44 | TestResult.xml 45 | 46 | # Build Results of an ATL Project 47 | [Dd]ebugPS/ 48 | [Rr]eleasePS/ 49 | dlldata.c 50 | 51 | # Benchmark Results 52 | BenchmarkDotNet.Artifacts/ 53 | 54 | # .NET Core 55 | project.lock.json 56 | project.fragment.lock.json 57 | artifacts/ 58 | 59 | # StyleCop 60 | StyleCopReport.xml 61 | 62 | # Files built by Visual Studio 63 | *_i.c 64 | *_p.c 65 | *_h.h 66 | *.ilk 67 | *.meta 68 | *.obj 69 | *.iobj 70 | *.pch 71 | *.pdb 72 | *.ipdb 73 | *.pgc 74 | *.pgd 75 | *.rsp 76 | *.sbr 77 | *.tlb 78 | *.tli 79 | *.tlh 80 | *.tmp 81 | *.tmp_proj 82 | *_wpftmp.csproj 83 | *.log 84 | *.vspscc 85 | *.vssscc 86 | .builds 87 | *.pidb 88 | *.svclog 89 | *.scc 90 | 91 | # Chutzpah Test files 92 | _Chutzpah* 93 | 94 | # Visual C++ cache files 95 | ipch/ 96 | *.aps 97 | *.ncb 98 | *.opendb 99 | *.opensdf 100 | *.sdf 101 | *.cachefile 102 | *.VC.db 103 | *.VC.VC.opendb 104 | 105 | # Visual Studio profiler 106 | *.psess 107 | *.vsp 108 | *.vspx 109 | *.sap 110 | 111 | # Visual Studio Trace Files 112 | *.e2e 113 | 114 | # TFS 2012 Local Workspace 115 | $tf/ 116 | 117 | # Guidance Automation Toolkit 118 | *.gpState 119 | 120 | # ReSharper is a .NET coding add-in 121 | _ReSharper*/ 122 | *.[Rr]e[Ss]harper 123 | *.DotSettings.user 124 | 125 | # JustCode is a .NET coding add-in 126 | .JustCode 127 | 128 | # TeamCity is a build add-in 129 | _TeamCity* 130 | 131 | # DotCover is a Code Coverage Tool 132 | *.dotCover 133 | 134 | # AxoCover is a Code Coverage Tool 135 | .axoCover/* 136 | !.axoCover/settings.json 137 | 138 | # Visual Studio code coverage results 139 | *.coverage 140 | *.coveragexml 141 | 142 | # NCrunch 143 | _NCrunch_* 144 | .*crunch*.local.xml 145 | nCrunchTemp_* 146 | 147 | # MightyMoose 148 | *.mm.* 149 | AutoTest.Net/ 150 | 151 | # Web workbench (sass) 152 | .sass-cache/ 153 | 154 | # Installshield output folder 155 | [Ee]xpress/ 156 | 157 | # DocProject is a documentation generator add-in 158 | DocProject/buildhelp/ 159 | DocProject/Help/*.HxT 160 | DocProject/Help/*.HxC 161 | DocProject/Help/*.hhc 162 | DocProject/Help/*.hhk 163 | DocProject/Help/*.hhp 164 | DocProject/Help/Html2 165 | DocProject/Help/html 166 | 167 | # Click-Once directory 168 | publish/ 169 | 170 | # Publish Web Output 171 | *.[Pp]ublish.xml 172 | *.azurePubxml 173 | # Note: Comment the next line if you want to checkin your web deploy settings, 174 | # but database connection strings (with potential passwords) will be unencrypted 175 | *.pubxml 176 | *.publishproj 177 | 178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 179 | # checkin your Azure Web App publish settings, but sensitive information contained 180 | # in these scripts will be unencrypted 181 | PublishScripts/ 182 | 183 | # NuGet Packages 184 | *.nupkg 185 | # The packages folder can be ignored because of Package Restore 186 | **/[Pp]ackages/* 187 | # except build/, which is used as an MSBuild target. 188 | !**/[Pp]ackages/build/ 189 | # Uncomment if necessary however generally it will be regenerated when needed 190 | #!**/[Pp]ackages/repositories.config 191 | # NuGet v3's project.json files produces more ignorable files 192 | *.nuget.props 193 | *.nuget.targets 194 | 195 | # Microsoft Azure Build Output 196 | csx/ 197 | *.build.csdef 198 | 199 | # Microsoft Azure Emulator 200 | ecf/ 201 | rcf/ 202 | 203 | # Windows Store app package directories and files 204 | AppPackages/ 205 | BundleArtifacts/ 206 | Package.StoreAssociation.xml 207 | _pkginfo.txt 208 | *.appx 209 | 210 | # Visual Studio cache files 211 | # files ending in .cache can be ignored 212 | *.[Cc]ache 213 | # but keep track of directories ending in .cache 214 | !?*.[Cc]ache/ 215 | 216 | # Others 217 | ClientBin/ 218 | ~$* 219 | *~ 220 | *.dbmdl 221 | *.dbproj.schemaview 222 | *.jfm 223 | *.pfx 224 | *.publishsettings 225 | orleans.codegen.cs 226 | 227 | # Including strong name files can present a security risk 228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 229 | #*.snk 230 | 231 | # Since there are multiple workflows, uncomment next line to ignore bower_components 232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 233 | #bower_components/ 234 | 235 | # RIA/Silverlight projects 236 | Generated_Code/ 237 | 238 | # Backup & report files from converting an old project file 239 | # to a newer Visual Studio version. Backup files are not needed, 240 | # because we have git ;-) 241 | _UpgradeReport_Files/ 242 | Backup*/ 243 | UpgradeLog*.XML 244 | UpgradeLog*.htm 245 | ServiceFabricBackup/ 246 | *.rptproj.bak 247 | 248 | # SQL Server files 249 | *.mdf 250 | *.ldf 251 | *.ndf 252 | 253 | # Business Intelligence projects 254 | *.rdl.data 255 | *.bim.layout 256 | *.bim_*.settings 257 | *.rptproj.rsuser 258 | *- Backup*.rdl 259 | 260 | # Microsoft Fakes 261 | FakesAssemblies/ 262 | 263 | # GhostDoc plugin setting file 264 | *.GhostDoc.xml 265 | 266 | # Node.js Tools for Visual Studio 267 | .ntvs_analysis.dat 268 | node_modules/ 269 | 270 | # Visual Studio 6 build log 271 | *.plg 272 | 273 | # Visual Studio 6 workspace options file 274 | *.opt 275 | 276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 277 | *.vbw 278 | 279 | # Visual Studio LightSwitch build output 280 | **/*.HTMLClient/GeneratedArtifacts 281 | **/*.DesktopClient/GeneratedArtifacts 282 | **/*.DesktopClient/ModelManifest.xml 283 | **/*.Server/GeneratedArtifacts 284 | **/*.Server/ModelManifest.xml 285 | _Pvt_Extensions 286 | 287 | # Paket dependency manager 288 | .paket/paket.exe 289 | paket-files/ 290 | 291 | # FAKE - F# Make 292 | .fake/ 293 | 294 | # JetBrains Rider 295 | .idea/ 296 | *.sln.iml 297 | 298 | # CodeRush personal settings 299 | .cr/personal 300 | 301 | # Python Tools for Visual Studio (PTVS) 302 | __pycache__/ 303 | *.pyc 304 | 305 | # Cake - Uncomment if you are using it 306 | # tools/** 307 | # !tools/packages.config 308 | 309 | # Tabs Studio 310 | *.tss 311 | 312 | # Telerik's JustMock configuration file 313 | *.jmconfig 314 | 315 | # BizTalk build output 316 | *.btp.cs 317 | *.btm.cs 318 | *.odx.cs 319 | *.xsd.cs 320 | 321 | # OpenCover UI analysis results 322 | OpenCover/ 323 | 324 | # Azure Stream Analytics local run output 325 | ASALocalRun/ 326 | 327 | # MSBuild Binary and Structured Log 328 | *.binlog 329 | 330 | # NVidia Nsight GPU debugger configuration file 331 | *.nvuser 332 | 333 | # MFractors (Xamarin productivity tool) working folder 334 | .mfractor/ 335 | 336 | # Local History for Visual Studio 337 | .localhistory/ 338 | 339 | # BeatPulse healthcheck temp database 340 | healthchecksdb -------------------------------------------------------------------------------- /wasm3_dll/wasm3_dll.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {2836e529-0bba-407b-aba3-50b25f502fba} 25 | wasm3dll 26 | 10.0 27 | wasm3_dll 28 | 29 | 30 | 31 | DynamicLibrary 32 | true 33 | v143 34 | Unicode 35 | 36 | 37 | DynamicLibrary 38 | false 39 | v143 40 | true 41 | Unicode 42 | 43 | 44 | DynamicLibrary 45 | true 46 | v143 47 | Unicode 48 | 49 | 50 | DynamicLibrary 51 | false 52 | v143 53 | true 54 | Unicode 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | true 76 | wasm3 77 | $(Configuration)\ 78 | 79 | 80 | false 81 | wasm3 82 | $(Configuration)\ 83 | 84 | 85 | true 86 | wasm3 87 | $(Configuration)\ 88 | $(Configuration)\ 89 | 90 | 91 | false 92 | wasm3 93 | $(Configuration)\ 94 | $(Configuration)\ 95 | 96 | 97 | 98 | TurnOffAllWarnings 99 | false 100 | d_m3HasTracer;_CRT_SECURE_NO_WARNINGS 101 | true 102 | false 103 | 104 | 105 | Console 106 | true 107 | wasm3.def 108 | 109 | 110 | 111 | 112 | TurnOffAllWarnings 113 | true 114 | true 115 | false 116 | d_m3HasTracer;_CRT_SECURE_NO_WARNINGS 117 | true 118 | 119 | 120 | Console 121 | true 122 | true 123 | true 124 | wasm3.def 125 | 126 | 127 | 128 | 129 | TurnOffAllWarnings 130 | false 131 | d_m3HasTracer;_CRT_SECURE_NO_WARNINGS 132 | true 133 | 134 | 135 | Console 136 | true 137 | wasm3.def 138 | 139 | 140 | 141 | 142 | TurnOffAllWarnings 143 | true 144 | true 145 | false 146 | d_m3HasTracer;_CRT_SECURE_NO_WARNINGS 147 | true 148 | 149 | 150 | Console 151 | true 152 | true 153 | true 154 | wasm3.def 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | --------------------------------------------------------------------------------