Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ----------------------------------------------------------------------------
- // <auto-generated>
- // This is autogenerated code by CppSharp.
- // Do not edit this file or all your changes will be lost after re-generation.
- // </auto-generated>
- // ----------------------------------------------------------------------------
- using System;
- using System.Runtime.InteropServices;
- using System.Security;
- public unsafe partial class Test : IDisposable
- {
- [StructLayout(LayoutKind.Explicit, Size = 24)]
- public partial struct __Internal
- {
- [FieldOffset(0)]
- internal global::Std.Vector.__Internalc__N_std_S_vector__I___N_std_S_allocator__I m_data;
- [SuppressUnmanagedCodeSecurity]
- [DllImport("Test", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
- EntryPoint="??0Test@@QEAA@AEBV0@@Z")]
- internal static extern global::System.IntPtr cctor(global::System.IntPtr instance, global::System.IntPtr _0);
- [SuppressUnmanagedCodeSecurity]
- [DllImport("Test", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
- EntryPoint="??1Test@@QEAA@XZ")]
- internal static extern void dtor(global::System.IntPtr instance, int delete);
- }
- public global::System.IntPtr __Instance { get; protected set; }
- protected int __PointerAdjustment;
- internal static readonly global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Test> NativeToManagedMap = new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::Test>();
- protected void*[] __OriginalVTables;
- protected bool __ownsNativeInstance;
- internal static global::Test __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
- {
- return new global::Test(native.ToPointer(), skipVTables);
- }
- internal static global::Test __CreateInstance(global::Test.__Internal native, bool skipVTables = false)
- {
- return new global::Test(native, skipVTables);
- }
- private static void* __CopyValue(global::Test.__Internal native)
- {
- var ret = Marshal.AllocHGlobal(sizeof(global::Test.__Internal));
- global::Test.__Internal.cctor(ret, new global::System.IntPtr(&native));
- return ret.ToPointer();
- }
- private Test(global::Test.__Internal native, bool skipVTables = false)
- : this(__CopyValue(native), skipVTables)
- {
- __ownsNativeInstance = true;
- NativeToManagedMap[__Instance] = this;
- }
- protected Test(void* native, bool skipVTables = false)
- {
- if (native == null)
- return;
- __Instance = new global::System.IntPtr(native);
- }
- public Test(global::Test _0)
- {
- __Instance = Marshal.AllocHGlobal(sizeof(global::Test.__Internal));
- __ownsNativeInstance = true;
- NativeToManagedMap[__Instance] = this;
- if (ReferenceEquals(_0, null))
- throw new global::System.ArgumentNullException("_0", "Cannot be null because it is a C++ reference (&).");
- var __arg0 = _0.__Instance;
- __Internal.cctor((__Instance + __PointerAdjustment), __arg0);
- }
- public void Dispose()
- {
- Dispose(disposing: true);
- }
- public virtual void Dispose(bool disposing)
- {
- if (__Instance == IntPtr.Zero)
- return;
- global::Test __dummy;
- NativeToManagedMap.TryRemove(__Instance, out __dummy);
- if (disposing)
- __Internal.dtor((__Instance + __PointerAdjustment), 0);
- if (__ownsNativeInstance)
- Marshal.FreeHGlobal(__Instance);
- __Instance = IntPtr.Zero;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement