/// <summary> /// Tests a library loader to determine whether it is valid for the current Linux platform. /// </summary> private static LibraryLoader TestLibraryLoaderForLinux(LibraryLoader loader) { try { loader.CoreLoadNativeLibrary(null); } catch (Exception e) { if (e is DllNotFoundException || e is EntryPointNotFoundException) { return(null); } else { throw; } } return(loader); }
/// <summary> /// Initializes a new instance of the <see cref="NativeLibrary"/> class. /// </summary> /// <param name="names">An ordered collection of library names. Each name is tried in /// turn until the library is successfully loaded.</param> /// <param name="loader">The <see cref="LibraryLoader"/> which is used to load the library /// and retrieve function pointers.</param> /// <param name="pathResolver">A <see cref="PathResolver"/> instance which determines the algorithm /// for resolving library paths from library names.</param> public NativeLibrary(IEnumerable <String> names, LibraryLoader loader, PathResolver pathResolver) { this.loader = loader; this.Handle = loader.LoadNativeLibrary(names, pathResolver); }
/// <summary> /// Initializes a new instance of the <see cref="NativeLibrary"/> class. /// </summary> /// <param name="name">The name of the library to load.</param> /// <param name="loader">The <see cref="LibraryLoader"/> which is used to load the library /// and retrieve function pointers.</param> /// <param name="pathResolver">A <see cref="PathResolver"/> instance which determines the algorithm /// for resolving library paths from library names.</param> public NativeLibrary(String name, LibraryLoader loader, PathResolver pathResolver) { this.loader = loader; this.Handle = loader.LoadNativeLibrary(name, pathResolver); }
/// <summary> /// Initializes a new instance of the <see cref="NativeLibrary"/> class. /// </summary> /// <param name="names">An ordered collection of library names. Each name is tried in /// turn until the library is successfully loaded.</param> /// <param name="loader">The <see cref="LibraryLoader"/> which is used to load the library /// and retrieve function pointers.</param> public NativeLibrary(IEnumerable <String> names, LibraryLoader loader) : this(names, loader, PathResolver.Default) { }
/// <summary> /// Initializes a new instance of the <see cref="NativeLibrary"/> class. /// </summary> /// <param name="name">The name of the library to load.</param> /// <param name="loader">The <see cref="LibraryLoader"/> which is used to load the library /// and retrieve function pointers.</param> public NativeLibrary(String name, LibraryLoader loader) : this(name, loader, PathResolver.Default) { }