Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cbd917d

Browse filesBrowse files
authored
Add more detail to GetFunctionPointerForDelegate docs (#11401)
1 parent 0d76620 commit cbd917d
Copy full SHA for cbd917d

File tree

Expand file treeCollapse file tree

1 file changed

+10
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-1
lines changed

‎xml/System.Runtime.InteropServices/Marshal.xml

Copy file name to clipboardExpand all lines: xml/System.Runtime.InteropServices/Marshal.xml
+10-1Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3989,10 +3989,15 @@ The code retrieves a reference to an instance of Microsoft Word successfully. Ho
39893989

39903990
You must manually keep the delegate from being collected by the garbage collector from managed code. The garbage collector does not track references to unmanaged code.
39913991

3992+
This API is unsupported in environments that don't support dynamic entry-point allocation, such as `ProcessDynamicCodePolicy` on Windows, `execmem off` in SELinux, and WebAssembly.
3993+
3994+
It is recommended to use function pointers and <xref:System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute> instead. Function pointers are more efficient, easier to use correctly, and supported in all environments.
3995+
39923996
]]></format>
39933997
</remarks>
39943998
<exception cref="T:System.ArgumentException">The <paramref name="d" /> parameter is a generic type definition.</exception>
39953999
<exception cref="T:System.ArgumentNullException">The <paramref name="d" /> parameter is <see langword="null" />.</exception>
4000+
<exception cref="T:System.PlatformNotSupportedException">Dynamic entrypoint allocation is not supported in the current environment.</exception>
39964001
</Docs>
39974002
</Member>
39984003
<Member MemberName="GetFunctionPointerForDelegate&lt;TDelegate&gt;">
@@ -4058,11 +4063,15 @@ The code retrieves a reference to an instance of Microsoft Word successfully. Ho
40584063
The delegate `d` is converted to a function pointer that can be passed to unmanaged code by using [the default platform calling convention](/dotnet/standard/native-interop/calling-conventions#platform-default-calling-convention). You can set the calling convention by applying the <xref:System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute> to the delegate.
40594064

40604065
You must manually keep the delegate from being collected by the garbage collector from managed code. The garbage collector does not track references to unmanaged code.
4061-
4066+
4067+
This API is unsupported in environments that don't support dynamic entry-point allocation, such as `ProcessDynamicCodePolicy` on Windows, `execmem off` in SELinux, and WebAssembly.
4068+
4069+
It is recommended to use function pointers and <xref:System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute> instead. Function pointers are more efficient, easier to use correctly, and supported in all environments.
40624070
]]></format>
40634071
</remarks>
40644072
<exception cref="T:System.ArgumentException">The <paramref name="d" /> parameter is a generic type definition.</exception>
40654073
<exception cref="T:System.ArgumentNullException">The <paramref name="d" /> parameter is <see langword="null" />.</exception>
4074+
<exception cref="T:System.PlatformNotSupportedException">Dynamic entrypoint allocation is not supported in the current environment.</exception>
40664075
</Docs>
40674076
</Member>
40684077
<Member MemberName="GetHINSTANCE">

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.