UnmanagedCallConvAttribute 클래스

정의

관리되지 않는 코드에서 구현된 P/Invoke 메서드를 호출하는 데 필요한 호출 규칙을 지정합니다.

public ref class UnmanagedCallConvAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
public sealed class UnmanagedCallConvAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)>]
type UnmanagedCallConvAttribute = class
    inherit Attribute
Public NotInheritable Class UnmanagedCallConvAttribute
Inherits Attribute
상속
UnmanagedCallConvAttribute
특성

예제

다음 예제에서는 를 사용하여 UnmanagedCallConvAttribute P/Invokes를 선언하여 호출 규칙을 지정합니다.

호출 규칙 cdecl 사용:

// Target will be invoked using the cdecl calling convention
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
[DllImport("NativeLibrary", EntryPoint = "native_function_cdecl")]
internal static extern int NativeFunction(int arg);

// Target will be invoked using the cdecl calling convention and with the GC transition suppressed
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl), typeof(CallConvSuppressGCTransition) })]
[DllImport("NativeLibrary", EntryPoint = "native_function_cdecl")]
internal static extern int NativeFunction_NoGCTransition(int arg);

호출 규칙 stdcall 사용:

// Target will be invoked using the stdcall calling convention
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvStdcall) })]
[DllImport("NativeLibrary", EntryPoint = "native_function_stdcall")]
internal static extern int NativeFunction(int arg);

// Target will be invoked using the stdcall calling convention and with the GC transition suppressed
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvStdcall), typeof(CallConvSuppressGCTransition) })]
[DllImport("NativeLibrary", EntryPoint = "native_function_stdcall")]
internal static extern int NativeFunction_NoGCTransition(int arg);

설명

이 특성이 가 CallingConvention 설정되지 않았거나 로 DllImportAttribute 설정된 메서드에 Winapi적용되면 .NET 런타임은 를 사용하여 CallConvs P/Invoke의 호출 규칙을 결정합니다.

이 특성은 가 없거나 DllImportAttributeCallingConvention 가 아닌 Winapi다른 것으로 설정된 메서드에 적용된 경우 무시됩니다.

생성자

UnmanagedCallConvAttribute()

UnmanagedCallConvAttribute 인스턴스를 초기화합니다.

필드

CallConvs

선택 사항입니다. 관리되지 않는 대상에 대한 호출 규칙을 나타내는 형식입니다.

속성

TypeId

파생 클래스에서 구현된 경우 이 Attribute에 대한 고유 식별자를 가져옵니다.

(다음에서 상속됨 Attribute)

메서드

Equals(Object)

이 인스턴스가 지정된 개체와 같은지를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.

(다음에서 상속됨 Attribute)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
IsDefaultAttribute()

파생 클래스에서 재정의된 경우 이 인스턴스 값이 파생 클래스에 대한 기본값인지 여부를 표시합니다.

(다음에서 상속됨 Attribute)
Match(Object)

파생 클래스에서 재정의된 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상