/// <summary> /// Attempts to load the address of the exported symbol with the given name. /// </summary> /// <param name="name">The name of the exported symbol.</param> /// <param name="addr">The address of the symbol.</param> /// <returns>If the load was successful.</returns> public static bool TryGetExport(string name, out IntPtr addr) { if (Handle != IntPtr.Zero && NativeLibrary.TryGetExport(Handle, name, out addr)) { return(true); } else { addr = IntPtr.Zero; return(false); } }
/// <summary> /// Attempts to load the address of the exported symbol with the given name. /// </summary> /// <param name="name">The name of the exported symbol.</param> /// <returns>The address of the exported symbol.</returns> /// <exception cref="InvalidOperationException">The Vulkan library is not loaded.</exception> /// <exception cref="ArgumentException">The symbol with the given name was not found.</exception> public static IntPtr GetExport(string name) { if (Handle == IntPtr.Zero) { throw new InvalidOperationException("The Vulkan library is not loaded"); } if (NativeLibrary.TryGetExport(Handle, name, out var addr)) { return(addr); } else { throw new ArgumentException($"Could not load symbol '{name}'", nameof(name)); } }