title: Importing native methods in Xamarin.Mac
body: <p>I'm looking for a way to use <code>SCNetworkInterfaceCopyAll</code> in my Xamarin.Mac app.
  I've imported it</p>
  
  <pre><code>[DllImport("/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration")]
  public static extern IntPtr SCNetworkInterfaceCopyAll();
  </code></pre>
  
  <p>Then I get an array by calling <code>var array = NSArray.ArrayFromHandle&lt;NSObject&gt;(pointer)</code>.
  But can't figure out how to get values from the output array of SCNetworkInterface. I've tried to marshal it as </p>
  
  <pre><code>[StructLayout(LayoutKind.Sequential)]
  public struct Test
  {
      IntPtr interface_type;
      IntPtr entity_hardware;
  }
  </code></pre>
  
  <p>And then call <code>Marshal.PtrToStructure&lt;Test&gt;(i.Handle)</code> but it gives random pointers instead of meaningful values.</p>