Bewerken

Delen via


NativeLibrary.SetDllImportResolver(Assembly, DllImportResolver) Method

Definition

Sets a callback for resolving native library imports from an assembly.

public:
 static void SetDllImportResolver(System::Reflection::Assembly ^ assembly, System::Runtime::InteropServices::DllImportResolver ^ resolver);
public static void SetDllImportResolver (System.Reflection.Assembly assembly, System.Runtime.InteropServices.DllImportResolver resolver);
static member SetDllImportResolver : System.Reflection.Assembly * System.Runtime.InteropServices.DllImportResolver -> unit
Public Shared Sub SetDllImportResolver (assembly As Assembly, resolver As DllImportResolver)

Parameters

assembly
Assembly

The assembly for which the resolver is registered.

resolver
DllImportResolver

The resolver callback to register.

Exceptions

assembly or resolver is null.

A resolver is already set for this assembly.

Remarks

This per-assembly resolver is the first attempt to resolve native library loads initiated by this assembly.

The callers of this method should register the resolver for their own assemblies only.

Only one resolver can be registered per assembly. Trying to register a second resolver fails with an InvalidOperationException.

Applies to