PkmnLibRSharp/PkmnLibRSharp/FFI/DynamicData/Libraries/ScriptResolver.cs

43 lines
1.9 KiB
C#

using System;
using System.Runtime.InteropServices;
namespace PkmnLibSharp.FFI.DynamicData.Libraries
{
internal static class ScriptResolver
{
/// <summary>
/// Instantiates a basic empty script resolver, that always returns None.
/// </summary>
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer empty_script_resolver_new();
/// <summary>
/// Drops a script resolver.
/// </summary>
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern void script_resolver_drop(IntPtr ptr);
// WASM is a feature flag in the crate, and can be disabled. If disabled, these entry points do not exist. In
// this case it's recommended to remove the WASM compile flag from the csproj as well.
#if WASM
/// <summary>
/// Instantiates a new WebAssemblyScriptResolver.
/// </summary>
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer webassembly_script_resolver_new();
/// <summary>
/// Load a compiled WASM module.
/// </summary>
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern void webassembly_script_resolver_load_wasm_from_bytes(IntPtr resolver, IntPtr byteArray,
ulong arrayLength);
/// <summary>
/// Tells the script resolver we're done loading wasm modules, and to finalize the resolver.
/// </summary>
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern void webassembly_script_resolver_finalize(IntPtr resolver);
#endif
}
}