Advertisement
mattparks5855

Generated C# output

May 20th, 2018
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.68 KB | None | 0 0
  1. // ----------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This is autogenerated code by CppSharp.
  4. // Do not edit this file or all your changes will be lost after re-generation.
  5. // </auto-generated>
  6. // ----------------------------------------------------------------------------
  7. using System;
  8. using System.Runtime.InteropServices;
  9. using System.Security;
  10.  
  11. public unsafe partial class Test : IDisposable
  12. {
  13.     [StructLayout(LayoutKind.Explicit, Size = 24)]
  14.     public partial struct __Internal
  15.     {
  16.         [FieldOffset(0)]
  17.         internal global::Std.Vector.__Internalc__N_std_S_vector__I___N_std_S_allocator__I m_data;
  18.  
  19.         [SuppressUnmanagedCodeSecurity]
  20.         [DllImport("Test", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
  21.             EntryPoint="??0Test@@QEAA@AEBV0@@Z")]
  22.         internal static extern global::System.IntPtr cctor(global::System.IntPtr instance, global::System.IntPtr _0);
  23.  
  24.         [SuppressUnmanagedCodeSecurity]
  25.         [DllImport("Test", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
  26.             EntryPoint="??1Test@@QEAA@XZ")]
  27.         internal static extern void dtor(global::System.IntPtr instance, int delete);
  28.     }
  29.  
  30.     public global::System.IntPtr __Instance { get; protected set; }
  31.  
  32.     protected int __PointerAdjustment;
  33.     internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Test> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Test>();
  34.     protected void*[] __OriginalVTables;
  35.  
  36.     protected bool __ownsNativeInstance;
  37.  
  38.     internal static global::Test __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
  39.     {
  40.         return new global::Test(native.ToPointer(), skipVTables);
  41.     }
  42.  
  43.     internal static global::Test __CreateInstance(global::Test.__Internal native, bool skipVTables = false)
  44.     {
  45.         return new global::Test(native, skipVTables);
  46.     }
  47.  
  48.     private static void* __CopyValue(global::Test.__Internal native)
  49.     {
  50.         var ret = Marshal.AllocHGlobal(sizeof(global::Test.__Internal));
  51.         global::Test.__Internal.cctor(ret, new global::System.IntPtr(&native));
  52.         return ret.ToPointer();
  53.     }
  54.  
  55.     private Test(global::Test.__Internal native, bool skipVTables = false)
  56.         : this(__CopyValue(native), skipVTables)
  57.     {
  58.         __ownsNativeInstance = true;
  59.         NativeToManagedMap[__Instance] = this;
  60.     }
  61.  
  62.     protected Test(void* native, bool skipVTables = false)
  63.     {
  64.         if (native == null)
  65.             return;
  66.         __Instance = new global::System.IntPtr(native);
  67.     }
  68.  
  69.     public Test(global::Test _0)
  70.     {
  71.         __Instance = Marshal.AllocHGlobal(sizeof(global::Test.__Internal));
  72.         __ownsNativeInstance = true;
  73.         NativeToManagedMap[__Instance] = this;
  74.         if (ReferenceEquals(_0, null))
  75.             throw new global::System.ArgumentNullException("_0", "Cannot be null because it is a C++ reference (&).");
  76.         var __arg0 = _0.__Instance;
  77.         __Internal.cctor((__Instance + __PointerAdjustment), __arg0);
  78.     }
  79.  
  80.     public void Dispose()
  81.     {
  82.         Dispose(disposing: true);
  83.     }
  84.  
  85.     public virtual void Dispose(bool disposing)
  86.     {
  87.         if (__Instance == IntPtr.Zero)
  88.             return;
  89.         global::Test __dummy;
  90.         NativeToManagedMap.TryRemove(__Instance, out __dummy);
  91.         if (disposing)
  92.             __Internal.dtor((__Instance + __PointerAdjustment), 0);
  93.         if (__ownsNativeInstance)
  94.             Marshal.FreeHGlobal(__Instance);
  95.         __Instance = IntPtr.Zero;
  96.     }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement