Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ InternalGetFunctionPointer()

static IntPtr Internal.Runtime.InteropServices.ComponentActivator.InternalGetFunctionPointer ( AssemblyLoadContext alc,
string typeName,
string methodName,
IntPtr delegateTypeNative )
inlinestaticprivate

Definition at line 119 of file ComponentActivator.cs.

120 {
121 Func<AssemblyName, Assembly> assemblyResolver = (AssemblyName name) => alc.LoadFromAssemblyName(name);
122 Type type;
124 {
126 }
127 else if (delegateTypeNative == (IntPtr)(-1))
128 {
129 type = null;
130 }
131 else
132 {
133 string typeName2 = MarshalToString(delegateTypeNative, "delegateTypeNative");
135 }
138 if (type == null)
139 {
140 BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
142 if (method == null)
143 {
144 throw new MissingMethodException(typeName, methodName);
145 }
146 if (method.GetCustomAttribute<UnmanagedCallersOnlyAttribute>() == null)
147 {
149 }
150 intPtr = method.MethodHandle.GetFunctionPointer();
151 }
152 else
153 {
157 {
159 }
160 }
161 return intPtr;
162 }
static readonly Dictionary< IntPtr, Delegate > s_delegates
static string MarshalToString(IntPtr arg, string argName)
delegate int ComponentEntryPoint(IntPtr args, int sizeBytes)
static ? Delegate CreateDelegate(Type type, object target, string method, bool ignoreCase, bool throwOnBindFailure)
Definition Delegate.cs:152
static IntPtr GetFunctionPointerForDelegate(Delegate d)
Definition Marshal.cs:1457
static string InvalidOperation_FunctionMissingUnmanagedCallersOnly
Definition SR.cs:1690
Definition SR.cs:7
static ? Type GetType(string typeName, bool throwOnError, bool ignoreCase)
Definition Type.cs:408
static readonly IntPtr Zero
Definition IntPtr.cs:18

References Internal.Runtime.InteropServices.ComponentActivator.ComponentEntryPoint(), System.Delegate.CreateDelegate(), System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(), System.Type.GetType(), System.SR.InvalidOperation_FunctionMissingUnmanagedCallersOnly, Internal.Runtime.InteropServices.ComponentActivator.MarshalToString(), Internal.Runtime.InteropServices.ComponentActivator.s_delegates, System.type, and System.IntPtr.Zero.

Referenced by Internal.Runtime.InteropServices.ComponentActivator.GetFunctionPointer(), and Internal.Runtime.InteropServices.ComponentActivator.LoadAssemblyAndGetFunctionPointer().