DllImportResolver 대리자

정의

콜백을 통해 네이티브 라이브러리를 확인하는 데 사용되는 대리자를 제공합니다.

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 

매개 변수

libraryName
String

확인할 네이티브 라이브러리입니다.

assembly
Assembly

해결을 요청하는 어셈블리입니다.

searchPath
Nullable<DllImportSearchPath>

DefaultDllImportSearchPathsAttribute PInvoke의 경우 그렇지 않으면 DefaultDllImportSearchPathsAttribute 어셈블리의 어셈블리(있는 경우)입니다. 그렇지 않으면 null.

반환 값

IntPtr

nativeint

성공 또는 Zero 실패에 대해 로드된 네이티브 라이브러리에 대한 핸들입니다.

설명

런타임은 .에서 반환된 DllImportResolver핸들을 중심으로 수명 관리를 수행하지 않습니다. 필요한 경우 라이브러리를 로드된 상태로 유지하고 필요한 경우 해제하기 위해 구현 및 사용 코드에 남아 있습니다.

확인자는 일반적으로 각 PInvoke 진입점에 대해 한 번 호출됩니다. 성능을 향상시키기 위해 라이브러리를 통해 Free(IntPtr)언로드되지 않는 한 확인자의 구현은 매핑을 처리하기 위해 캐시 libraryName 할 수 있습니다.

확장명 메서드

Name Description
GetMethodInfo(Delegate)

지정된 대리자가 나타내는 메서드를 나타내는 개체를 가져옵니다.

적용 대상