public SdlLibrary(uint flags) { var path = this.CurrentPlatform() ?? throw new NullReferenceException("Failed to load SDL path."); _nativeLibraryInterface = NativeLibraryInterface.FromFile <ISdl2>(path, ResolveName); try { int result = Library.Init(flags); if (result != 0) { throw new SdlException("Failed to initialize SDL: " + Library.GetError()); } } catch { _nativeLibraryInterface.Dispose(); throw; } }
public SqliteLibrary(string file) { _nativeLibraryInterface = NativeLibraryInterface.FromFile <ISqlite3>(file, ResolveName); try { // https://www.sqlite.org/c3ref/initialize.html var result = Library.Initialize(); if (result != SqliteResult.Ok) { throw new SqliteException( "Error on sqlite3_initialize().", KeyValuePair.Create(result, result.ToString())); } } catch { _nativeLibraryInterface.Dispose(); throw; } }
public void Dispose() { _nativeLibraryInterface.Library.Quit(); _nativeLibraryInterface.Dispose(); }
public void Dispose() { _nativeLibraryInterface.Library.Shutdown(); _nativeLibraryInterface.Dispose(); }