Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        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;
            }
        }
Esempio n. 3
0
 public void Dispose()
 {
     _nativeLibraryInterface.Library.Quit();
     _nativeLibraryInterface.Dispose();
 }
Esempio n. 4
0
 public void Dispose()
 {
     _nativeLibraryInterface.Library.Shutdown();
     _nativeLibraryInterface.Dispose();
 }