다음을 통해 공유


MonoNativeFunctionWrapperAttribute 클래스

정의

에 사용할 GetDelegateForFunctionPointer(IntPtr, Type)수 있는 대상으로 플래그를 지정하기 위해 대리자에게 적용할 특성입니다.

[System.AttributeUsage(System.AttributeTargets.Delegate)]
public sealed class MonoNativeFunctionWrapperAttribute : Attribute
type MonoNativeFunctionWrapperAttribute = class
    inherit Attribute
상속
MonoNativeFunctionWrapperAttribute
특성

설명

Xamarin.iOS는 완전히 정적으로 컴파일된 모드에서 실행되므로 이 특성을 사용하여 에 전달될 수 있는 대리자 메서드에 플래그를 GetDelegateForFunctionPointer(IntPtr, Type) 지정해야 합니다. 이렇게 하면 네이티브 함수에 대한 포인터가 메서드에 대한 호출 가능한 관리 대리자를 생성할 수 있도록 필요한 코드를 생성하도록 AOT 컴파일러에 지시합니다.

[MonoNativeFunctionWrapper]
delegate void SomeDelegate (int a, int b);

// 
// the ptrToFunc points to an unmanaged C function with the signature (int a, int b)
void Callback (IntPtr ptrToFunc)
{
	var del = (SomeDelegate) Marshal.GetDelegateForFunctionPointer (ptrToFunc, typeof (SomeDelegate));

	// invoke it
	del (1, 2);
}

생성자

MonoNativeFunctionWrapperAttribute()

기본 생성자입니다.

적용 대상