Skip to content

Update documentation on RuntimeMethodHandle.GetFunctionPointer #8061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion xml/System/RuntimeMethodHandle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
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.

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.

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.
]]></format>
</remarks>
<exception cref="T:System.Security.SecurityException">The caller does not have the necessary permission to perform this operation.</exception>
Expand Down