Note: This method is new in the .NET Framework version 2.0.
Converts a delegate into a function pointer callable from unmanaged code.
Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Visual Basic (Declaration)
Public Shared Function GetFunctionPointerForDelegate ( _
d As Delegate _
) As IntPtr
Dim d As Delegate
Dim returnValue As IntPtr
returnValue = Marshal.GetFunctionPointerForDelegate(d)
public static IntPtr GetFunctionPointerForDelegate (
Delegate d
)
public:
static IntPtr GetFunctionPointerForDelegate (
Delegate^ d
)
public static IntPtr GetFunctionPointerForDelegate (
Delegate d
)
public static function GetFunctionPointerForDelegate (
d : Delegate
) : IntPtr
Parameters
- d
The delegate to be passed to unmanaged code.
Return Value
An System.IntPtr value that can be passed to unmanaged code, which in turn can use it to call the underlying managed delegate.
| Exception type | Condition |
|---|
ArgumentNullException | The d parameter is a null reference (Nothing in Visual Basic). |
The delegate d is converted to a function pointer that can be passed to unmanaged code.
Note that you must manually keep the delegate from being collected by the garbage collector (GC) from managed code. The GC does not track reference to unmanaged code.
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
.NET Framework
Supported in: 2.0
.NET Compact Framework
Supported in: 2.0