title: PInvoke C#: Function takes pointer to function as argument
body: <p>I'd like to access this function in my c# code, is this possible? so in the end the c++ code would call my function and also apply the struct called "sFrameofData". </p>
  
  <p>C++ Code:</p>
  
  <pre><code>//The user supplied function will be called whenever a frame of data arrives.
  DLL int Cortex_SetDataHandlerFunc(void (*MyFunction)(sFrameOfData* pFrameOfData));
  </code></pre>
  
  <p>Would this work perhaps?</p>
  
  <p>C# Code:</p>
  
  <pre><code>[DllImport("Cortex_SDK.dll")]
  public extern static int Cortex_SetDataHandlerFunc(ref IntPtr function(ref IntPtr pFrameOfData) );
  </code></pre>