DllImportResolver Delegate

Definition

Provides a delegate used to resolve native libraries via callback.

public delegate IntPtr DllImportResolver(System::String ^ libraryName, Assembly ^ assembly, Nullable<DllImportSearchPath> searchPath);
public delegate IntPtr DllImportResolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath);
type DllImportResolver = delegate of string * Assembly * Nullable<DllImportSearchPath> -> nativeint
Public Delegate Function DllImportResolver(libraryName As String, assembly As Assembly, searchPath As Nullable(Of DllImportSearchPath)) As IntPtr 

Parameters

libraryName
String

The native library to resolve.

assembly
Assembly

The assembly requesting the resolution.

searchPath
Nullable<DllImportSearchPath>

The DefaultDllImportSearchPathsAttribute on the PInvoke, if any. Otherwise, the DefaultDllImportSearchPathsAttribute on the assembly, if any. Otherwise null.

Return Value

IntPtr

nativeint

The handle for the loaded native library on success, or Zero on failure.

Remarks

The runtime does not do any lifetime management around the handle returned by a DllImportResolver. It is left to the implementation and consuming code to keep the library loaded for as long as necessary and free it if/when desired.

Extension Methods

GetMethodInfo(Delegate)

Gets an object that represents the method represented by the specified delegate.

Applies to