<Type Name="MonoNativeFunctionWrapperAttribute" FullName="MonoMac.MonoNativeFunctionWrapperAttribute">
  <TypeSignature Language="C#" Value="public class MonoNativeFunctionWrapperAttribute : Attribute" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit MonoNativeFunctionWrapperAttribute 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.Delegate)</AttributeName>
    </Attribute>
  </Attributes>
  <Docs>
    <summary>Attribute to apply to delegates to flag them as targets that can be used with <see cref="M:System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer" />.</summary>
    <remarks>
      <para>

	Since MonoMac runs in fully statically compiled mode, it is
	necessary to flag delegate methods that might be passed to the
	<see cref="M:System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer" />
	with this attribute.  This instructs the AOT compiler to
	generate the necessary code to allow a pointer to a native
	function to produce a C# callable delegate for the method.

      </para>
      <example>
        <code lang="C#">
[MonoNativeFunctionWrapper]
delegate void SomeDelegate (int a, int b);

// 
// the ptrToFunc points to an unmanaged C function with the signature (int a, int b)
void Callback (IntPtr ptrToFunc)
{
	var del = (SomeDelegate) Marshal.GetDelegateForFunctionPointer (ptrToFunc, typeof (SomeDelegate));

	// invoke it
	del (1, 2);
}
	</code>
      </example>
    </remarks>
  </Docs>
  <Members>
    <Member MemberName=".ctor">
      <MemberSignature Language="C#" Value="public MonoNativeFunctionWrapperAttribute ();" />
      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
      <MemberType>Constructor</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <Parameters />
      <Docs>
        <summary>Default constructor.</summary>
        <remarks>
        </remarks>
      </Docs>
    </Member>
  </Members>
</Type>
