MonoMac 0.0.0.0 System.Attribute System.AttributeUsage(System.AttributeTargets.Method) Attribute used to annotate functions that will be called back from the unmanaged world.

This attribute is valid on static functions and it is used by Mono's Ahead of Time Compiler to generate the code necessary to support native call calling back into managed code.

In regular ECMA CIL programs this happens automatically, and it is not necessary to flag anything specially, but with pure Ahead of Time compilation the compiler needs to know which methods will be called from the unmanaged code.

In the current version of MonoMac, only static functions can be called back from unmanaged code.

You must specify the type of the delegate that this code will be called as. The following example shows the scenario in which this is used:

`using System; delegate void DrawPatternCallback (IntPtr voidptr, IntPtr cgcontextref); [StructLayout (LayoutKind.Sequential)] struct SetupStruct { int x, y; DrawPatternCallback draw; } [MonoPInvokeCallback (typeof (DrawPatternCallback))] static void DrawCallback (IntPtr voidptr, IntPtr cgcontextptr) { // This method is called from the C library }`
- Constructor
  0.0.0.0
  The typeof the delegate that will be calling us back.
  Constructor for the MonoPInvokeCallbackAttribute.

  You must specify the type of the delegate that this code will be called as. The following example shows the scenario in which this is used:

  using System; delegate void DrawPatternCallback (IntPtr voidptr, IntPtr cgcontextref);

  [StructLayout (LayoutKind.Sequential)] struct SetupStruct { int x, y; DrawPatternCallback draw; }

  [MonoPInvokeCallback (typeof (DrawPatternCallback))] static void DrawCallback (IntPtr voidptr, IntPtr cgcontextptr) { // This method is called from the C library }