-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFunctionRegistration.cs
More file actions
45 lines (36 loc) · 1.82 KB
/
Copy pathFunctionRegistration.cs
File metadata and controls
45 lines (36 loc) · 1.82 KB
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
39
40
41
42
43
44
45
using System;
using System.Runtime.InteropServices;
namespace DynaCall;
/// <summary>
/// Holds the fully-resolved metadata and bound delegate for a single registered
/// function — the runtime counterpart of one <c>DynamicWrapper.Register</c> call.
/// </summary>
internal sealed class FunctionRegistration
{
/// <summary>The DLL that exports the function — "(address)" for RegisterAddr / RegisterCode.</summary>
public required string DllName { get; init; }
/// <summary>The exported symbol name.</summary>
public required string FunctionName { get; init; }
/// <summary>Ordered parameter descriptors — one per argument.</summary>
public required ArgSpec[] ParameterSpecs { get; init; }
/// <summary>Return-type descriptor.</summary>
public required ArgSpec ReturnSpec { get; init; }
/// <summary>Unmanaged calling convention — StdCall or Cdecl.</summary>
public required CallingConvention Convention { get; init; }
/// <summary>
/// When true, the delegate was built with <c>SetLastError = true</c> so the runtime
/// saves the Win32 last-error code immediately after each call.
/// </summary>
public required bool CaptureLastError { get; init; }
/// <summary>
/// The dynamically-emitted delegate <see cref="Type"/> — decorated with
/// <see cref="UnmanagedFunctionPointerAttribute"/> and per-parameter
/// <see cref="MarshalAsAttribute"/> annotations.
/// </summary>
public required Type DelegateType { get; init; }
/// <summary>
/// The live delegate wired to the native function pointer.
/// Cast to <see cref="DelegateType"/> for direct invocation.
/// </summary>
public required Delegate BoundDelegate { get; init; }
}