using System; using System.Runtime.InteropServices; namespace PkmnLibSharp.FFI.DynamicData.Libraries { internal static class ScriptResolver { /// /// Instantiates a basic empty script resolver, that always returns None. /// [DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] internal static extern IdentifiablePointer empty_script_resolver_new(); /// /// Drops a script resolver. /// [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 /// /// Instantiates a new WebAssemblyScriptResolver. /// [DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] internal static extern IdentifiablePointer webassembly_script_resolver_new(); /// /// Load a compiled WASM module. /// [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); /// /// Tells the script resolver we're done loading wasm modules, and to finalize the resolver. /// [DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] internal static extern void webassembly_script_resolver_finalize(IntPtr resolver); #endif } }