/
UnmanagedCallersOnlyAttribute.cs
38 lines (35 loc) · 1.68 KB
/
UnmanagedCallersOnlyAttribute.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Runtime.InteropServices
{
/// <summary>
/// Any method marked with <see cref="UnmanagedCallersOnlyAttribute" /> can be directly called from
/// native code. The function token can be loaded to a local variable using the <see href="https://docs.microsoft.com/dotnet/csharp/language-reference/operators/pointer-related-operators#address-of-operator-">address-of</see> operator
/// in C# and passed as a callback to a native method.
/// </summary>
/// <remarks>
/// Methods marked with this attribute have the following restrictions:
/// * Method must be marked "static".
/// * Must not be called from managed code.
/// * Must only have <see href="https://docs.microsoft.com/dotnet/framework/interop/blittable-and-non-blittable-types">blittable</see> arguments.
/// </remarks>
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public sealed class UnmanagedCallersOnlyAttribute : Attribute
{
public UnmanagedCallersOnlyAttribute()
{
}
/// <summary>
/// Optional. If omitted, the runtime will use the default platform calling convention.
/// </summary>
/// <remarks>
/// Supplied types must be from the official "System.Runtime.CompilerServices" namespace and
/// be of the form "CallConvXXX".
/// </remarks>
public Type[]? CallConvs;
/// <summary>
/// Optional. If omitted, no named export is emitted during compilation.
/// </summary>
public string? EntryPoint;
}
}