Skip to content

Commit f4a2b6e

Browse files
author
Ron Petrusha
authored
Clarified result of marshaling a delegate (#6133)
1 parent bd76bb3 commit f4a2b6e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docs/framework/interop/default-marshaling-behavior.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Default Marshaling Behavior"
3-
ms.date: "03/30/2017"
3+
ms.date: "06/26/2018"
44
dev_langs:
55
- "csharp"
66
- "vb"
@@ -107,7 +107,9 @@ interface DelegateTest : IDispatch {
107107
```
108108

109109
A function pointer can be dereferenced, just as any other unmanaged function pointer can be dereferenced.
110-
110+
111+
In this example, when the two delegates are marshaled as <xref:System.Runtime.InteropServices.UnmanagedType.FunctionPtr?displayProperty=nameWithType>, the result is an `int` and a pointer to an `int`. Because delegate types are being marshaled, `int` here represents a pointer to a void (`void*`), which is the address of the delegate in memory. In other words, this result is specific to 32-bit Windows systems, since `int` here represents the size of the function pointer.
112+
111113
> [!NOTE]
112114
> A reference to the function pointer to a managed delegate held by unmanaged code does not prevent the common language runtime from performing garbage collection on the managed object.
113115

0 commit comments

Comments
 (0)