AssemblyLoadContext.LoadUnmanagedDll(String) Method

Definition

Allows derived class to load an unmanaged library by name.

protected:
 virtual IntPtr LoadUnmanagedDll(System::String ^ unmanagedDllName);
protected virtual IntPtr LoadUnmanagedDll (string unmanagedDllName);
abstract member LoadUnmanagedDll : string -> nativeint
override this.LoadUnmanagedDll : string -> nativeint
Protected Overridable Function LoadUnmanagedDll (unmanagedDllName As String) As IntPtr

Parameters

unmanagedDllName
String

Name of the unmanaged library. Typically this is the filename without its path or extensions.

Returns

IntPtr

nativeint

A handle to the loaded library, or Zero.

Remarks

The default implementation always returns IntPtr.Zero. When IntPtr.Zero is returned, the runtime loads the library with its default policy.

This virtual method can be overridden to customize the unmanaged library search algorithm. When overridden the name can be used to identify the library. The loaded library does not need to match the requested name, but can be transformed as needed. This could include adjusting the name for platform specific naming.

Applies to