Table of Contents

Method TryLoad

Namespace
Ubiquity.NET.InteropHelpers
Assembly
Ubiquity.NET.InteropHelpers.dll

TryLoad(string, out NativeLibraryHandle)

Provides a simple API for loading a native library and returns a value that indicates whether the operation succeeded.

public static bool TryLoad(string libraryPath, out NativeLibraryHandle lib)

Parameters

libraryPath string

The name of the native library to be loaded.

lib NativeLibraryHandle

Native library handle.

Returns

bool

true if the native library was loaded successfully; otherwise, false.

Exceptions

ArgumentNullException

libraryPath is null.

TryLoad(string, Assembly, DllImportSearchPath?, out NativeLibraryHandle)

Provides a high-level API that loads a native library and returns a value that indicates whether the operation succeeded.

public static bool TryLoad(string libraryName, Assembly assembly, DllImportSearchPath? searchPath, out NativeLibraryHandle lib)

Parameters

libraryName string

The name of the native library to be loaded.

assembly Assembly

The assembly loading the native library.

searchPath DllImportSearchPath?

The search path.

lib NativeLibraryHandle

Native library Handle

Returns

bool

true if the native library was loaded successfully; otherwise, false.

Exceptions

ArgumentNullException

libraryPath or assembly is null.

ArgumentException

assembly is not a RuntimeAssembly.