Skip to content

Commit 6435f0a

Browse files
Update documentation on RuntimeMethodHandle.GetFunctionPointer (dotnet#8061)
Co-authored-by: Genevieve Warren <[email protected]>
1 parent c2ff20f commit 6435f0a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

xml/System/RuntimeMethodHandle.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,10 @@
251251
<remarks>
252252
<format type="text/markdown"><![CDATA[
253253
## Remarks
254-
The returned <xref:System.IntPtr> is meant for internal runtime usage and should not be used to call the function from native code. Use <xref:System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate%2A?displayProperty=nameWithType> in order to get a function pointer that can be passed to native code.
254+
255+
If the method has the <xref:System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute?displayProperty=nameWithType> attribute, then the returned value is an unmanaged function pointer with the same calling convention as specified in the attribute. If the method this handle represents is static, then the returned value can be cast to a C# managed function pointer type with the same signature. For instance method handles, the value is not easily usable from user code and is meant exclusively for usage within the runtime.
256+
257+
For methods that don't have the <xref:System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute?displayProperty=nameWithType>, use <xref:System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate%2A?displayProperty=nameWithType> to get a function pointer that can be passed to native code.
255258
]]></format>
256259
</remarks>
257260
<exception cref="T:System.Security.SecurityException">The caller does not have the necessary permission to perform this operation.</exception>

0 commit comments

Comments
 (0)