<Type Name="MonoPInvokeCallbackAttribute" FullName="MonoMac.MonoPInvokeCallbackAttribute">
  <TypeSignature Language="C#" Value="public sealed class MonoPInvokeCallbackAttribute : Attribute" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit MonoPInvokeCallbackAttribute extends System.Attribute" />
  <AssemblyInfo>
    <AssemblyName>MonoMac</AssemblyName>
    <AssemblyVersion>0.0.0.0</AssemblyVersion>
  </AssemblyInfo>
  <Base>
    <BaseTypeName>System.Attribute</BaseTypeName>
  </Base>
  <Interfaces />
  <Attributes>
    <Attribute>
      <AttributeName>System.AttributeUsage(System.AttributeTargets.Method)</AttributeName>
    </Attribute>
  </Attributes>
  <Docs>
    <summary>Attribute used to annotate functions that will be called back from the unmanaged world.</summary>
    <remarks>
      <para>
       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.
      </para>
      <para>

	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.

      </para>
      <para>

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

      </para>
      <para>

	  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:

	 </para>
      <code lang="C#">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
	}
</code>
    </remarks>
  </Docs>
  <Members>
    <Member MemberName=".ctor">
      <MemberSignature Language="C#" Value="public MonoPInvokeCallbackAttribute (Type t);" />
      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Type t) cil managed" />
      <MemberType>Constructor</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <Parameters>
        <Parameter Name="t" Type="System.Type" />
      </Parameters>
      <Docs>
        <param name="t">The typeof the delegate that will be calling us back.</param>
        <summary>Constructor for the MonoPInvokeCallbackAttribute.</summary>
        <remarks>
          <para>

	  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:

	 </para>
          <code lang="C#">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
	}
</code>
        </remarks>
      </Docs>
    </Member>
  </Members>
</Type>
