Prelink Method
Collapse the table of content
Expand the table of content

Marshal.Prelink Method (MethodInfo)


Executes one-time method setup tasks without calling the method.

Namespace:   System.Runtime.InteropServices
Assembly:  mscorlib (in mscorlib.dll)

public static void Prelink(
	MethodInfo m


Type: System.Reflection.MethodInfo

The method to be checked.

Exception Condition

The m parameter is null.


The m parameter is not a MethodInfo object.

Setup tasks provide early initialization and are performed automatically when the target method is invoked. First-time tasks include the following:

  • Verifying that the platform invoke metadata is correctly formatted.

  • Verifying that all the managed types are valid parameters of platform invoke functions.

  • Locating and loading the unmanaged DLL into the process.

  • Locating the entry point in the process.

Calling Prelink on a method outside of platform invoke has no effect. To execute setup tasks on all platform invoke methods in a type, use Marshal.PrelinkAll.


requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

.NET Framework
Available since 1.1
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
© 2015 Microsoft