Class Module
Represents a WebAssembly module, created from a byte array containing the WebAssembly code.
Namespace: WasmerSharp
Assembly: WasmerSharp.dll
Syntax
public class Module : WasmerSharp.WasmerNativeHandle
Remarks
Use the Create method to create new instances of a module.
Properties
ExportDescriptors
Gets export descriptors for the given module
Declaration
public WasmerSharp.ExportDescriptor[] ExportDescriptors { get; }
Property Value
Type | Description |
---|---|
ExportDescriptor[] | To be added. |
ImportDescriptors
Returns the Import Descriptors for this module
Declaration
public WasmerSharp.ImportDescriptor[] ImportDescriptors { get; }
Property Value
Type | Description |
---|---|
ImportDescriptor[] | To be added. |
Methods
Create(Byte[])
Creates a new Module from the given WASM bytes
Declaration
public static WasmerSharp.Module Create (byte[] wasmBody);
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | wasmBody | An array containing the WASM code to load into the module |
Returns
Type | Description |
---|---|
Module | The WasmerModule instance, or null on error. You can use the LastError error property to get details on the error. |
Create(IntPtr, UInt32)
Creates a new Module from the given WASM bytes pointed to by the specified address
Declaration
public static WasmerSharp.Module Create (IntPtr wasmBody, uint bodyLength);
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | wasmBody | A pointer to a block of memory containing the WASM code to load into the module |
System.UInt32 | bodyLength | The size of the wasmBody pointer |
Returns
Type | Description |
---|---|
Module | The WasmerModule instance, or null on error. You can use the LastError error property to get details on the error. |
Instatiate(Import[])
Creates a new Instance from the given wasm bytes and imports.
Declaration
public WasmerSharp.Instance Instatiate (WasmerSharp.Import[] imports);
Parameters
Type | Name | Description |
---|---|---|
Import[] | imports | The list of imports to pass, usually Function, Global and Memory |
Returns
Type | Description |
---|---|
Instance | A Wasmer.Instance on success, or null on error. You can use the LastError error property to get details on the error. |
Serialize()
Serializes the module, the result can be turned into a byte array and saved.
Declaration
public WasmerSharp.SerializedModule Serialize ();
Returns
Type | Description |
---|---|
SerializedModule | Null on error, or an instance of SerializedModule on success. You can use the LastError error property to get details on the error. |
Validate(Byte[])
Validates a byte array for being a valid web assembly package.
Declaration
public bool Validate (byte[] buffer);
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | Array containing the webassembly package to validate |
Returns
Type | Description |
---|---|
System.Boolean | True if this contains a valid webassembly package, false otherwise. |
Validate(IntPtr, UInt32)
Validates a block of bytes for being a valid web assembly package.
Declaration
public bool Validate (IntPtr bytes, uint len);
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | bytes | Pointer to the bytes that contain the webassembly payload |
System.UInt32 | len | Length of the buffer. |
Returns
Type | Description |
---|---|
System.Boolean | True if this contains a valid webassembly package, false otherwise. |