Browse Source

Moved the include and library dirs and defines from the general options to the modules.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
cpp_module_crash
Dimitar Dobrev 9 years ago
parent
commit
3258da2ff8
  1. 4
      build/Parser.lua
  2. 399
      src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppParser.cs
  3. 8
      src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs
  4. 391
      src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppParser.cs
  5. 8
      src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs
  6. 399
      src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppParser.cs
  7. 399
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs
  8. 351
      src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppParser.cs
  9. 6
      src/CppParser/Bindings/ParserGen.cs
  10. 18
      src/CppParser/CppParser.cpp
  11. 17
      src/CppParser/CppParser.h
  12. 22
      src/CppParser/Parser.cpp
  13. 1
      src/CppParser/Parser.h
  14. 6
      src/Generator/Module.cs
  15. 26
      src/Generator/Options.cs

4
build/Parser.lua

@ -11,9 +11,5 @@ function SetupCSharpParser()
end end
function SetupParser() function SetupParser()
if string.match(action, "vs*") and os.is_windows() then
SetupCLIParser()
else
SetupCSharpParser() SetupCSharpParser()
end
end end

399
src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppParser.cs

@ -1,8 +1,6 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp. // This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation. // Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -47,9 +45,352 @@ namespace CppSharp
User = 4 User = 4
} }
public unsafe abstract partial class AbstractModule : IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 52)]
public partial struct Internal
{
[FieldOffset(0)]
public global::System.IntPtr vfptr0;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModuleC2Ev")]
internal static extern void ctor_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModuleC2ERKS1_")]
internal static extern void cctor_1(global::System.IntPtr instance, global::System.IntPtr _0);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule14getIncludeDirsEj")]
internal static extern global::System.IntPtr getIncludeDirs_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule14addIncludeDirsEPKc")]
internal static extern void addIncludeDirs_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule16clearIncludeDirsEv")]
internal static extern void clearIncludeDirs_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule14getLibraryDirsEj")]
internal static extern global::System.IntPtr getLibraryDirs_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule14addLibraryDirsEPKc")]
internal static extern void addLibraryDirs_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule16clearLibraryDirsEv")]
internal static extern void clearLibraryDirs_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule10getDefinesEj")]
internal static extern global::System.IntPtr getDefines_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule10addDefinesEPKc")]
internal static extern void addDefines_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule12clearDefinesEv")]
internal static extern void clearDefines_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule12getUndefinesEj")]
internal static extern global::System.IntPtr getUndefines_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule12addUndefinesEPKc")]
internal static extern void addUndefines_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule14clearUndefinesEv")]
internal static extern void clearUndefines_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule19getIncludeDirsCountEv")]
internal static extern uint getIncludeDirsCount_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule19getLibraryDirsCountEv")]
internal static extern uint getLibraryDirsCount_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule15getDefinesCountEv")]
internal static extern uint getDefinesCount_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule17getUndefinesCountEv")]
internal static extern uint getUndefinesCount_0(global::System.IntPtr instance);
}
public global::System.IntPtr __Instance { get; protected set; }
protected int __PointerAdjustment;
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, AbstractModule> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, AbstractModule>();
protected void*[] __OriginalVTables;
protected bool __ownsNativeInstance;
public static AbstractModule __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
{
return new AbstractModuleInternal(native.ToPointer(), skipVTables);
}
public static AbstractModule __CreateInstance(AbstractModule.Internal native, bool skipVTables = false)
{
return new AbstractModuleInternal(native, skipVTables);
}
protected AbstractModule(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
if (skipVTables)
__OriginalVTables = new void*[] { ((Internal*) native)->vfptr0.ToPointer() };
else
SetupVTables(true);
}
protected AbstractModule()
{
__Instance = Marshal.AllocHGlobal(52);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0((__Instance + __PointerAdjustment));
SetupVTables(GetType().FullName == "CppSharp.CppParser.dll.CppSharp.Parser.AbstractModule");
}
protected AbstractModule(CppSharp.Parser.AbstractModule _0)
{
__Instance = Marshal.AllocHGlobal(52);
__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_1((__Instance + __PointerAdjustment), arg0);
SetupVTables(GetType().FullName == "CppSharp.CppParser.dll.CppSharp.Parser.AbstractModule");
}
public void Dispose()
{
Dispose(disposing: true);
}
protected virtual void Dispose(bool disposing)
{
CppSharp.Parser.AbstractModule __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
((Internal*) __Instance)->vfptr0 = new global::System.IntPtr(__OriginalVTables[0]);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
}
public string getIncludeDirs(uint i)
{
var __ret = Internal.getIncludeDirs_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addIncludeDirs(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addIncludeDirs_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearIncludeDirs()
{
Internal.clearIncludeDirs_0((__Instance + __PointerAdjustment));
}
public string getLibraryDirs(uint i)
{
var __ret = Internal.getLibraryDirs_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addLibraryDirs(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addLibraryDirs_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearLibraryDirs()
{
Internal.clearLibraryDirs_0((__Instance + __PointerAdjustment));
}
public string getDefines(uint i)
{
var __ret = Internal.getDefines_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addDefines(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addDefines_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearDefines()
{
Internal.clearDefines_0((__Instance + __PointerAdjustment));
}
public string getUndefines(uint i)
{
var __ret = Internal.getUndefines_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addUndefines(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addUndefines_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearUndefines()
{
Internal.clearUndefines_0((__Instance + __PointerAdjustment));
}
public uint IncludeDirsCount
{
get
{
var __ret = Internal.getIncludeDirsCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
public uint LibraryDirsCount
{
get
{
var __ret = Internal.getLibraryDirsCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
public uint DefinesCount
{
get
{
var __ret = Internal.getDefinesCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
public uint UndefinesCount
{
get
{
var __ret = Internal.getUndefinesCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
#region Virtual table interop
// virtual ~AbstractModule() = 0
private static Delegates.Action_IntPtr _dtor_0DelegateInstance;
private static void _dtor_0DelegateHook(global::System.IntPtr instance)
{
if (!NativeToManagedMap.ContainsKey(instance))
throw new global::System.Exception("No managed instance was found");
var __target = (AbstractModule) NativeToManagedMap[instance];
if (__target.__ownsNativeInstance)
__target.SetupVTables();
__target.Dispose(false);
}
private static void*[] __ManagedVTables;
private static void*[] __ManagedVTablesDtorOnly;
private static void*[] _Thunks;
private void SetupVTables(bool destructorOnly = false)
{
if (__OriginalVTables != null)
return;
var native = (Internal*) __Instance.ToPointer();
__OriginalVTables = new void*[] { ((Internal*) native)->vfptr0.ToPointer() };
if (_Thunks == null)
{
_Thunks = new void*[1];
_dtor_0DelegateInstance += _dtor_0DelegateHook;
_Thunks[0] = Marshal.GetFunctionPointerForDelegate(_dtor_0DelegateInstance).ToPointer();
}
if (destructorOnly)
{
if (__ManagedVTablesDtorOnly == null)
{
__ManagedVTablesDtorOnly = new void*[1];
var vtptr = Marshal.AllocHGlobal(4 * 4);
var vfptr0 = vtptr + 2 * 4;
__ManagedVTablesDtorOnly[0] = vfptr0.ToPointer();
*(void**)(vfptr0 + -8) = *(void**)(native->vfptr0 + -8);
*(void**)(vfptr0 + -4) = *(void**)(native->vfptr0 + -4);
*(void**)(vfptr0 + 0) = *(void**)(native->vfptr0 + 0);
*(void**)(vfptr0 + 4) = _Thunks[0];
}
native->vfptr0 = new IntPtr(__ManagedVTablesDtorOnly[0]);
}
else
{
if (__ManagedVTables == null)
{
__ManagedVTables = new void*[1];
var vtptr = Marshal.AllocHGlobal(4 * 4);
var vfptr0 = vtptr + 2 * 4;
__ManagedVTables[0] = vfptr0.ToPointer();
*(void**)(vfptr0 + -8) = *(void**)(native->vfptr0 + -8);
*(void**)(vfptr0 + -4) = *(void**)(native->vfptr0 + -4);
*(void**)(vfptr0 + 0) = *(void**)(native->vfptr0 + 0);
*(void**)(vfptr0 + 4) = _Thunks[0];
}
native->vfptr0 = new IntPtr(__ManagedVTables[0]);
}
}
#endregion
}
public unsafe partial class ParserOptions : IDisposable public unsafe partial class ParserOptions : IDisposable
{ {
[StructLayout(LayoutKind.Explicit, Size = 120)] [StructLayout(LayoutKind.Explicit, Size = 124)]
public partial struct Internal public partial struct Internal
{ {
[FieldOffset(84)] [FieldOffset(84)]
@ -79,6 +420,9 @@ namespace CppSharp
[FieldOffset(116)] [FieldOffset(116)]
public global::System.IntPtr TargetInfo; public global::System.IntPtr TargetInfo;
[FieldOffset(120)]
public global::System.IntPtr Module;
[SuppressUnmanagedCodeSecurity] [SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser13ParserOptionsC2Ev")] EntryPoint="_ZN8CppSharp9CppParser13ParserOptionsC2Ev")]
@ -255,7 +599,7 @@ namespace CppSharp
private static void* __CopyValue(ParserOptions.Internal native) private static void* __CopyValue(ParserOptions.Internal native)
{ {
var ret = Marshal.AllocHGlobal(120); var ret = Marshal.AllocHGlobal(124);
CppSharp.Parser.ParserOptions.Internal.cctor_2(ret, new global::System.IntPtr(&native)); CppSharp.Parser.ParserOptions.Internal.cctor_2(ret, new global::System.IntPtr(&native));
return ret.ToPointer(); return ret.ToPointer();
} }
@ -276,7 +620,7 @@ namespace CppSharp
public ParserOptions() public ParserOptions()
{ {
__Instance = Marshal.AllocHGlobal(120); __Instance = Marshal.AllocHGlobal(124);
__ownsNativeInstance = true; __ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this; NativeToManagedMap[__Instance] = this;
Internal.ctor_0((__Instance + __PointerAdjustment)); Internal.ctor_0((__Instance + __PointerAdjustment));
@ -284,7 +628,7 @@ namespace CppSharp
public ParserOptions(CppSharp.Parser.ParserOptions _0) public ParserOptions(CppSharp.Parser.ParserOptions _0)
{ {
__Instance = Marshal.AllocHGlobal(120); __Instance = Marshal.AllocHGlobal(124);
__ownsNativeInstance = true; __ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this; NativeToManagedMap[__Instance] = this;
if (ReferenceEquals(_0, null)) if (ReferenceEquals(_0, null))
@ -627,6 +971,24 @@ namespace CppSharp
((Internal*) __Instance)->TargetInfo = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance; ((Internal*) __Instance)->TargetInfo = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
} }
} }
public CppSharp.Parser.AbstractModule Module
{
get
{
CppSharp.Parser.AbstractModule __result0;
if (((Internal*) __Instance)->Module == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AbstractModule.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->Module))
__result0 = (CppSharp.Parser.AbstractModule) CppSharp.Parser.AbstractModule.NativeToManagedMap[((Internal*) __Instance)->Module];
else CppSharp.Parser.AbstractModule.NativeToManagedMap[((Internal*) __Instance)->Module] = __result0 = (CppSharp.Parser.AbstractModule) CppSharp.Parser.AbstractModule.__CreateInstance(((Internal*) __Instance)->Module);
return __result0;
}
set
{
((Internal*) __Instance)->Module = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
}
}
} }
public unsafe partial class ParserDiagnostic : IDisposable public unsafe partial class ParserDiagnostic : IDisposable
@ -1156,5 +1518,30 @@ namespace CppSharp
return __result0; return __result0;
} }
} }
internal unsafe partial class AbstractModuleInternal : CppSharp.Parser.AbstractModule, IDisposable
{
private static void* __CopyValue(AbstractModule.Internal native)
{
var ret = Marshal.AllocHGlobal(52);
*(AbstractModule.Internal*) ret = native;
return ret.ToPointer();
}
internal AbstractModuleInternal(AbstractModule.Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
internal AbstractModuleInternal(void* native, bool skipVTables = false)
: base((void*) null)
{
__PointerAdjustment = 0;
__Instance = new global::System.IntPtr(native);
__OriginalVTables = new void*[] { ((Internal*) native)->vfptr0.ToPointer() };
}
}
} }
} }

8
src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Target.cs

@ -1,8 +1,6 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp. // This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation. // Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -756,3 +754,9 @@ namespace CppSharp
} }
} }
} }
namespace Delegates
{
[SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointerAttribute(global::System.Runtime.InteropServices.CallingConvention.Cdecl)]
public unsafe delegate void Action_IntPtr(global::System.IntPtr instance);
}

391
src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppParser.cs

@ -1,8 +1,6 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp. // This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation. // Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -47,9 +45,344 @@ namespace CppSharp
User = 4 User = 4
} }
public unsafe abstract partial class AbstractModule : IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 52)]
public partial struct Internal
{
[FieldOffset(0)]
public global::System.IntPtr vfptr0;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="??0AbstractModule@CppParser@CppSharp@@QAE@XZ")]
internal static extern global::System.IntPtr ctor_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="??0AbstractModule@CppParser@CppSharp@@QAE@ABV012@@Z")]
internal static extern global::System.IntPtr cctor_1(global::System.IntPtr instance, global::System.IntPtr _0);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?getIncludeDirs@AbstractModule@CppParser@CppSharp@@QAEPBDI@Z")]
internal static extern global::System.IntPtr getIncludeDirs_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?addIncludeDirs@AbstractModule@CppParser@CppSharp@@QAEXPBD@Z")]
internal static extern void addIncludeDirs_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?clearIncludeDirs@AbstractModule@CppParser@CppSharp@@QAEXXZ")]
internal static extern void clearIncludeDirs_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?getLibraryDirs@AbstractModule@CppParser@CppSharp@@QAEPBDI@Z")]
internal static extern global::System.IntPtr getLibraryDirs_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?addLibraryDirs@AbstractModule@CppParser@CppSharp@@QAEXPBD@Z")]
internal static extern void addLibraryDirs_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?clearLibraryDirs@AbstractModule@CppParser@CppSharp@@QAEXXZ")]
internal static extern void clearLibraryDirs_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?getDefines@AbstractModule@CppParser@CppSharp@@QAEPBDI@Z")]
internal static extern global::System.IntPtr getDefines_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?addDefines@AbstractModule@CppParser@CppSharp@@QAEXPBD@Z")]
internal static extern void addDefines_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?clearDefines@AbstractModule@CppParser@CppSharp@@QAEXXZ")]
internal static extern void clearDefines_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?getUndefines@AbstractModule@CppParser@CppSharp@@QAEPBDI@Z")]
internal static extern global::System.IntPtr getUndefines_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?addUndefines@AbstractModule@CppParser@CppSharp@@QAEXPBD@Z")]
internal static extern void addUndefines_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?clearUndefines@AbstractModule@CppParser@CppSharp@@QAEXXZ")]
internal static extern void clearUndefines_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?getIncludeDirsCount@AbstractModule@CppParser@CppSharp@@QAEIXZ")]
internal static extern uint getIncludeDirsCount_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?getLibraryDirsCount@AbstractModule@CppParser@CppSharp@@QAEIXZ")]
internal static extern uint getLibraryDirsCount_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?getDefinesCount@AbstractModule@CppParser@CppSharp@@QAEIXZ")]
internal static extern uint getDefinesCount_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="?getUndefinesCount@AbstractModule@CppParser@CppSharp@@QAEIXZ")]
internal static extern uint getUndefinesCount_0(global::System.IntPtr instance);
}
public global::System.IntPtr __Instance { get; protected set; }
protected int __PointerAdjustment;
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, AbstractModule> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, AbstractModule>();
protected void*[] __OriginalVTables;
protected bool __ownsNativeInstance;
public static AbstractModule __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
{
return new AbstractModuleInternal(native.ToPointer(), skipVTables);
}
public static AbstractModule __CreateInstance(AbstractModule.Internal native, bool skipVTables = false)
{
return new AbstractModuleInternal(native, skipVTables);
}
protected AbstractModule(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
if (skipVTables)
__OriginalVTables = new void*[] { ((Internal*) native)->vfptr0.ToPointer() };
else
SetupVTables(true);
}
protected AbstractModule()
{
__Instance = Marshal.AllocHGlobal(52);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0((__Instance + __PointerAdjustment));
SetupVTables(GetType().FullName == "CppSharp.CppParser.dll.CppSharp.Parser.AbstractModule");
}
protected AbstractModule(CppSharp.Parser.AbstractModule _0)
{
__Instance = Marshal.AllocHGlobal(52);
__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_1((__Instance + __PointerAdjustment), arg0);
SetupVTables(GetType().FullName == "CppSharp.CppParser.dll.CppSharp.Parser.AbstractModule");
}
public void Dispose()
{
Dispose(disposing: true);
}
protected virtual void Dispose(bool disposing)
{
CppSharp.Parser.AbstractModule __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
((Internal*) __Instance)->vfptr0 = new global::System.IntPtr(__OriginalVTables[0]);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
}
public string getIncludeDirs(uint i)
{
var __ret = Internal.getIncludeDirs_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addIncludeDirs(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addIncludeDirs_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearIncludeDirs()
{
Internal.clearIncludeDirs_0((__Instance + __PointerAdjustment));
}
public string getLibraryDirs(uint i)
{
var __ret = Internal.getLibraryDirs_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addLibraryDirs(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addLibraryDirs_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearLibraryDirs()
{
Internal.clearLibraryDirs_0((__Instance + __PointerAdjustment));
}
public string getDefines(uint i)
{
var __ret = Internal.getDefines_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addDefines(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addDefines_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearDefines()
{
Internal.clearDefines_0((__Instance + __PointerAdjustment));
}
public string getUndefines(uint i)
{
var __ret = Internal.getUndefines_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addUndefines(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addUndefines_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearUndefines()
{
Internal.clearUndefines_0((__Instance + __PointerAdjustment));
}
public uint IncludeDirsCount
{
get
{
var __ret = Internal.getIncludeDirsCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
public uint LibraryDirsCount
{
get
{
var __ret = Internal.getLibraryDirsCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
public uint DefinesCount
{
get
{
var __ret = Internal.getDefinesCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
public uint UndefinesCount
{
get
{
var __ret = Internal.getUndefinesCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
#region Virtual table interop
// virtual ~AbstractModule() = 0
private static Delegates.Action_IntPtr_int _dtor_0DelegateInstance;
private static void _dtor_0DelegateHook(global::System.IntPtr instance, int delete)
{
if (!NativeToManagedMap.ContainsKey(instance))
throw new global::System.Exception("No managed instance was found");
var __target = (AbstractModule) NativeToManagedMap[instance];
if (__target.__ownsNativeInstance)
__target.SetupVTables();
__target.Dispose(false);
}
private static void*[] __ManagedVTables;
private static void*[] __ManagedVTablesDtorOnly;
private static void*[] _Thunks;
private void SetupVTables(bool destructorOnly = false)
{
if (__OriginalVTables != null)
return;
var native = (Internal*) __Instance.ToPointer();
__OriginalVTables = new void*[] { ((Internal*) native)->vfptr0.ToPointer() };
if (_Thunks == null)
{
_Thunks = new void*[1];
_dtor_0DelegateInstance += _dtor_0DelegateHook;
_Thunks[0] = Marshal.GetFunctionPointerForDelegate(_dtor_0DelegateInstance).ToPointer();
}
if (destructorOnly)
{
if (__ManagedVTablesDtorOnly == null)
{
__ManagedVTablesDtorOnly = new void*[1];
var vfptr0 = Marshal.AllocHGlobal(1 * 4);
__ManagedVTablesDtorOnly[0] = vfptr0.ToPointer();
*(void**)(vfptr0 + 0) = _Thunks[0];
}
native->vfptr0 = new IntPtr(__ManagedVTablesDtorOnly[0]);
}
else
{
if (__ManagedVTables == null)
{
__ManagedVTables = new void*[1];
var vfptr0 = Marshal.AllocHGlobal(1 * 4);
__ManagedVTables[0] = vfptr0.ToPointer();
*(void**)(vfptr0 + 0) = _Thunks[0];
}
native->vfptr0 = new IntPtr(__ManagedVTables[0]);
}
}
#endregion
}
public unsafe partial class ParserOptions : IDisposable public unsafe partial class ParserOptions : IDisposable
{ {
[StructLayout(LayoutKind.Explicit, Size = 144)] [StructLayout(LayoutKind.Explicit, Size = 148)]
public partial struct Internal public partial struct Internal
{ {
[FieldOffset(96)] [FieldOffset(96)]
@ -79,6 +412,9 @@ namespace CppSharp
[FieldOffset(140)] [FieldOffset(140)]
public global::System.IntPtr TargetInfo; public global::System.IntPtr TargetInfo;
[FieldOffset(144)]
public global::System.IntPtr Module;
[SuppressUnmanagedCodeSecurity] [SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall, [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.ThisCall,
EntryPoint="??0ParserOptions@CppParser@CppSharp@@QAE@XZ")] EntryPoint="??0ParserOptions@CppParser@CppSharp@@QAE@XZ")]
@ -255,7 +591,7 @@ namespace CppSharp
private static void* __CopyValue(ParserOptions.Internal native) private static void* __CopyValue(ParserOptions.Internal native)
{ {
var ret = Marshal.AllocHGlobal(144); var ret = Marshal.AllocHGlobal(148);
CppSharp.Parser.ParserOptions.Internal.cctor_2(ret, new global::System.IntPtr(&native)); CppSharp.Parser.ParserOptions.Internal.cctor_2(ret, new global::System.IntPtr(&native));
return ret.ToPointer(); return ret.ToPointer();
} }
@ -276,7 +612,7 @@ namespace CppSharp
public ParserOptions() public ParserOptions()
{ {
__Instance = Marshal.AllocHGlobal(144); __Instance = Marshal.AllocHGlobal(148);
__ownsNativeInstance = true; __ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this; NativeToManagedMap[__Instance] = this;
Internal.ctor_0((__Instance + __PointerAdjustment)); Internal.ctor_0((__Instance + __PointerAdjustment));
@ -284,7 +620,7 @@ namespace CppSharp
public ParserOptions(CppSharp.Parser.ParserOptions _0) public ParserOptions(CppSharp.Parser.ParserOptions _0)
{ {
__Instance = Marshal.AllocHGlobal(144); __Instance = Marshal.AllocHGlobal(148);
__ownsNativeInstance = true; __ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this; NativeToManagedMap[__Instance] = this;
if (ReferenceEquals(_0, null)) if (ReferenceEquals(_0, null))
@ -627,6 +963,24 @@ namespace CppSharp
((Internal*) __Instance)->TargetInfo = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance; ((Internal*) __Instance)->TargetInfo = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
} }
} }
public CppSharp.Parser.AbstractModule Module
{
get
{
CppSharp.Parser.AbstractModule __result0;
if (((Internal*) __Instance)->Module == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AbstractModule.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->Module))
__result0 = (CppSharp.Parser.AbstractModule) CppSharp.Parser.AbstractModule.NativeToManagedMap[((Internal*) __Instance)->Module];
else CppSharp.Parser.AbstractModule.NativeToManagedMap[((Internal*) __Instance)->Module] = __result0 = (CppSharp.Parser.AbstractModule) CppSharp.Parser.AbstractModule.__CreateInstance(((Internal*) __Instance)->Module);
return __result0;
}
set
{
((Internal*) __Instance)->Module = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
}
}
} }
public unsafe partial class ParserDiagnostic : IDisposable public unsafe partial class ParserDiagnostic : IDisposable
@ -1156,5 +1510,30 @@ namespace CppSharp
return __result0; return __result0;
} }
} }
internal unsafe partial class AbstractModuleInternal : CppSharp.Parser.AbstractModule, IDisposable
{
private static void* __CopyValue(AbstractModule.Internal native)
{
var ret = Marshal.AllocHGlobal(52);
*(AbstractModule.Internal*) ret = native;
return ret.ToPointer();
}
internal AbstractModuleInternal(AbstractModule.Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
internal AbstractModuleInternal(void* native, bool skipVTables = false)
: base((void*) null)
{
__PointerAdjustment = 0;
__Instance = new global::System.IntPtr(native);
__OriginalVTables = new void*[] { ((Internal*) native)->vfptr0.ToPointer() };
}
}
} }
} }

8
src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Target.cs

@ -1,8 +1,6 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp. // This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation. // Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -756,3 +754,9 @@ namespace CppSharp
} }
} }
} }
namespace Delegates
{
[SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointerAttribute(global::System.Runtime.InteropServices.CallingConvention.ThisCall)]
public unsafe delegate void Action_IntPtr_int(global::System.IntPtr instance, int arg1);
}

399
src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppParser.cs

@ -1,8 +1,6 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp. // This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation. // Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -47,9 +45,352 @@ namespace CppSharp
User = 4 User = 4
} }
public unsafe abstract partial class AbstractModule : IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 104)]
public partial struct Internal
{
[FieldOffset(0)]
public global::System.IntPtr vfptr0;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModuleC2Ev")]
internal static extern void ctor_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModuleC2ERKS1_")]
internal static extern void cctor_1(global::System.IntPtr instance, global::System.IntPtr _0);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule14getIncludeDirsEj")]
internal static extern global::System.IntPtr getIncludeDirs_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule14addIncludeDirsEPKc")]
internal static extern void addIncludeDirs_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule16clearIncludeDirsEv")]
internal static extern void clearIncludeDirs_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule14getLibraryDirsEj")]
internal static extern global::System.IntPtr getLibraryDirs_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule14addLibraryDirsEPKc")]
internal static extern void addLibraryDirs_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule16clearLibraryDirsEv")]
internal static extern void clearLibraryDirs_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule10getDefinesEj")]
internal static extern global::System.IntPtr getDefines_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule10addDefinesEPKc")]
internal static extern void addDefines_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule12clearDefinesEv")]
internal static extern void clearDefines_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule12getUndefinesEj")]
internal static extern global::System.IntPtr getUndefines_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule12addUndefinesEPKc")]
internal static extern void addUndefines_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule14clearUndefinesEv")]
internal static extern void clearUndefines_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule19getIncludeDirsCountEv")]
internal static extern uint getIncludeDirsCount_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule19getLibraryDirsCountEv")]
internal static extern uint getLibraryDirsCount_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule15getDefinesCountEv")]
internal static extern uint getDefinesCount_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule17getUndefinesCountEv")]
internal static extern uint getUndefinesCount_0(global::System.IntPtr instance);
}
public global::System.IntPtr __Instance { get; protected set; }
protected int __PointerAdjustment;
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, AbstractModule> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, AbstractModule>();
protected void*[] __OriginalVTables;
protected bool __ownsNativeInstance;
public static AbstractModule __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
{
return new AbstractModuleInternal(native.ToPointer(), skipVTables);
}
public static AbstractModule __CreateInstance(AbstractModule.Internal native, bool skipVTables = false)
{
return new AbstractModuleInternal(native, skipVTables);
}
protected AbstractModule(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
if (skipVTables)
__OriginalVTables = new void*[] { ((Internal*) native)->vfptr0.ToPointer() };
else
SetupVTables(true);
}
protected AbstractModule()
{
__Instance = Marshal.AllocHGlobal(104);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0((__Instance + __PointerAdjustment));
SetupVTables(GetType().FullName == "CppSharp.CppParser.dll.CppSharp.Parser.AbstractModule");
}
protected AbstractModule(CppSharp.Parser.AbstractModule _0)
{
__Instance = Marshal.AllocHGlobal(104);
__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_1((__Instance + __PointerAdjustment), arg0);
SetupVTables(GetType().FullName == "CppSharp.CppParser.dll.CppSharp.Parser.AbstractModule");
}
public void Dispose()
{
Dispose(disposing: true);
}
protected virtual void Dispose(bool disposing)
{
CppSharp.Parser.AbstractModule __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
((Internal*) __Instance)->vfptr0 = new global::System.IntPtr(__OriginalVTables[0]);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
}
public string getIncludeDirs(uint i)
{
var __ret = Internal.getIncludeDirs_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addIncludeDirs(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addIncludeDirs_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearIncludeDirs()
{
Internal.clearIncludeDirs_0((__Instance + __PointerAdjustment));
}
public string getLibraryDirs(uint i)
{
var __ret = Internal.getLibraryDirs_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addLibraryDirs(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addLibraryDirs_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearLibraryDirs()
{
Internal.clearLibraryDirs_0((__Instance + __PointerAdjustment));
}
public string getDefines(uint i)
{
var __ret = Internal.getDefines_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addDefines(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addDefines_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearDefines()
{
Internal.clearDefines_0((__Instance + __PointerAdjustment));
}
public string getUndefines(uint i)
{
var __ret = Internal.getUndefines_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addUndefines(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addUndefines_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearUndefines()
{
Internal.clearUndefines_0((__Instance + __PointerAdjustment));
}
public uint IncludeDirsCount
{
get
{
var __ret = Internal.getIncludeDirsCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
public uint LibraryDirsCount
{
get
{
var __ret = Internal.getLibraryDirsCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
public uint DefinesCount
{
get
{
var __ret = Internal.getDefinesCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
public uint UndefinesCount
{
get
{
var __ret = Internal.getUndefinesCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
#region Virtual table interop
// virtual ~AbstractModule() = 0
private static Delegates.Action_IntPtr _dtor_0DelegateInstance;
private static void _dtor_0DelegateHook(global::System.IntPtr instance)
{
if (!NativeToManagedMap.ContainsKey(instance))
throw new global::System.Exception("No managed instance was found");
var __target = (AbstractModule) NativeToManagedMap[instance];
if (__target.__ownsNativeInstance)
__target.SetupVTables();
__target.Dispose(false);
}
private static void*[] __ManagedVTables;
private static void*[] __ManagedVTablesDtorOnly;
private static void*[] _Thunks;
private void SetupVTables(bool destructorOnly = false)
{
if (__OriginalVTables != null)
return;
var native = (Internal*) __Instance.ToPointer();
__OriginalVTables = new void*[] { ((Internal*) native)->vfptr0.ToPointer() };
if (_Thunks == null)
{
_Thunks = new void*[1];
_dtor_0DelegateInstance += _dtor_0DelegateHook;
_Thunks[0] = Marshal.GetFunctionPointerForDelegate(_dtor_0DelegateInstance).ToPointer();
}
if (destructorOnly)
{
if (__ManagedVTablesDtorOnly == null)
{
__ManagedVTablesDtorOnly = new void*[1];
var vtptr = Marshal.AllocHGlobal(4 * 8);
var vfptr0 = vtptr + 2 * 8;
__ManagedVTablesDtorOnly[0] = vfptr0.ToPointer();
*(void**)(vfptr0 + -16) = *(void**)(native->vfptr0 + -16);
*(void**)(vfptr0 + -8) = *(void**)(native->vfptr0 + -8);
*(void**)(vfptr0 + 0) = *(void**)(native->vfptr0 + 0);
*(void**)(vfptr0 + 8) = _Thunks[0];
}
native->vfptr0 = new IntPtr(__ManagedVTablesDtorOnly[0]);
}
else
{
if (__ManagedVTables == null)
{
__ManagedVTables = new void*[1];
var vtptr = Marshal.AllocHGlobal(4 * 8);
var vfptr0 = vtptr + 2 * 8;
__ManagedVTables[0] = vfptr0.ToPointer();
*(void**)(vfptr0 + -16) = *(void**)(native->vfptr0 + -16);
*(void**)(vfptr0 + -8) = *(void**)(native->vfptr0 + -8);
*(void**)(vfptr0 + 0) = *(void**)(native->vfptr0 + 0);
*(void**)(vfptr0 + 8) = _Thunks[0];
}
native->vfptr0 = new IntPtr(__ManagedVTables[0]);
}
}
#endregion
}
public unsafe partial class ParserOptions : IDisposable public unsafe partial class ParserOptions : IDisposable
{ {
[StructLayout(LayoutKind.Explicit, Size = 232)] [StructLayout(LayoutKind.Explicit, Size = 240)]
public partial struct Internal public partial struct Internal
{ {
[FieldOffset(168)] [FieldOffset(168)]
@ -79,6 +420,9 @@ namespace CppSharp
[FieldOffset(224)] [FieldOffset(224)]
public global::System.IntPtr TargetInfo; public global::System.IntPtr TargetInfo;
[FieldOffset(232)]
public global::System.IntPtr Module;
[SuppressUnmanagedCodeSecurity] [SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser13ParserOptionsC2Ev")] EntryPoint="_ZN8CppSharp9CppParser13ParserOptionsC2Ev")]
@ -255,7 +599,7 @@ namespace CppSharp
private static void* __CopyValue(ParserOptions.Internal native) private static void* __CopyValue(ParserOptions.Internal native)
{ {
var ret = Marshal.AllocHGlobal(232); var ret = Marshal.AllocHGlobal(240);
CppSharp.Parser.ParserOptions.Internal.cctor_2(ret, new global::System.IntPtr(&native)); CppSharp.Parser.ParserOptions.Internal.cctor_2(ret, new global::System.IntPtr(&native));
return ret.ToPointer(); return ret.ToPointer();
} }
@ -276,7 +620,7 @@ namespace CppSharp
public ParserOptions() public ParserOptions()
{ {
__Instance = Marshal.AllocHGlobal(232); __Instance = Marshal.AllocHGlobal(240);
__ownsNativeInstance = true; __ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this; NativeToManagedMap[__Instance] = this;
Internal.ctor_0((__Instance + __PointerAdjustment)); Internal.ctor_0((__Instance + __PointerAdjustment));
@ -284,7 +628,7 @@ namespace CppSharp
public ParserOptions(CppSharp.Parser.ParserOptions _0) public ParserOptions(CppSharp.Parser.ParserOptions _0)
{ {
__Instance = Marshal.AllocHGlobal(232); __Instance = Marshal.AllocHGlobal(240);
__ownsNativeInstance = true; __ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this; NativeToManagedMap[__Instance] = this;
if (ReferenceEquals(_0, null)) if (ReferenceEquals(_0, null))
@ -627,6 +971,24 @@ namespace CppSharp
((Internal*) __Instance)->TargetInfo = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance; ((Internal*) __Instance)->TargetInfo = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
} }
} }
public CppSharp.Parser.AbstractModule Module
{
get
{
CppSharp.Parser.AbstractModule __result0;
if (((Internal*) __Instance)->Module == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AbstractModule.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->Module))
__result0 = (CppSharp.Parser.AbstractModule) CppSharp.Parser.AbstractModule.NativeToManagedMap[((Internal*) __Instance)->Module];
else CppSharp.Parser.AbstractModule.NativeToManagedMap[((Internal*) __Instance)->Module] = __result0 = (CppSharp.Parser.AbstractModule) CppSharp.Parser.AbstractModule.__CreateInstance(((Internal*) __Instance)->Module);
return __result0;
}
set
{
((Internal*) __Instance)->Module = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
}
}
} }
public unsafe partial class ParserDiagnostic : IDisposable public unsafe partial class ParserDiagnostic : IDisposable
@ -1156,5 +1518,30 @@ namespace CppSharp
return __result0; return __result0;
} }
} }
internal unsafe partial class AbstractModuleInternal : CppSharp.Parser.AbstractModule, IDisposable
{
private static void* __CopyValue(AbstractModule.Internal native)
{
var ret = Marshal.AllocHGlobal(104);
*(AbstractModule.Internal*) ret = native;
return ret.ToPointer();
}
internal AbstractModuleInternal(AbstractModule.Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
internal AbstractModuleInternal(void* native, bool skipVTables = false)
: base((void*) null)
{
__PointerAdjustment = 0;
__Instance = new global::System.IntPtr(native);
__OriginalVTables = new void*[] { ((Internal*) native)->vfptr0.ToPointer() };
}
}
} }
} }

399
src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppParser.cs

@ -1,8 +1,6 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp. // This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation. // Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -47,9 +45,352 @@ namespace CppSharp
User = 4 User = 4
} }
public unsafe abstract partial class AbstractModule : IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 104)]
public partial struct Internal
{
[FieldOffset(0)]
public global::System.IntPtr vfptr0;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModuleC2Ev")]
internal static extern void ctor_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModuleC2ERKS1_")]
internal static extern void cctor_1(global::System.IntPtr instance, global::System.IntPtr _0);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule14getIncludeDirsEj")]
internal static extern global::System.IntPtr getIncludeDirs_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule14addIncludeDirsEPKc")]
internal static extern void addIncludeDirs_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule16clearIncludeDirsEv")]
internal static extern void clearIncludeDirs_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule14getLibraryDirsEj")]
internal static extern global::System.IntPtr getLibraryDirs_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule14addLibraryDirsEPKc")]
internal static extern void addLibraryDirs_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule16clearLibraryDirsEv")]
internal static extern void clearLibraryDirs_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule10getDefinesEj")]
internal static extern global::System.IntPtr getDefines_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule10addDefinesEPKc")]
internal static extern void addDefines_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule12clearDefinesEv")]
internal static extern void clearDefines_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule12getUndefinesEj")]
internal static extern global::System.IntPtr getUndefines_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule12addUndefinesEPKc")]
internal static extern void addUndefines_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule14clearUndefinesEv")]
internal static extern void clearUndefines_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule19getIncludeDirsCountEv")]
internal static extern uint getIncludeDirsCount_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule19getLibraryDirsCountEv")]
internal static extern uint getLibraryDirsCount_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule15getDefinesCountEv")]
internal static extern uint getDefinesCount_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser14AbstractModule17getUndefinesCountEv")]
internal static extern uint getUndefinesCount_0(global::System.IntPtr instance);
}
public global::System.IntPtr __Instance { get; protected set; }
protected int __PointerAdjustment;
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, AbstractModule> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, AbstractModule>();
protected void*[] __OriginalVTables;
protected bool __ownsNativeInstance;
public static AbstractModule __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
{
return new AbstractModuleInternal(native.ToPointer(), skipVTables);
}
public static AbstractModule __CreateInstance(AbstractModule.Internal native, bool skipVTables = false)
{
return new AbstractModuleInternal(native, skipVTables);
}
protected AbstractModule(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
if (skipVTables)
__OriginalVTables = new void*[] { ((Internal*) native)->vfptr0.ToPointer() };
else
SetupVTables(true);
}
protected AbstractModule()
{
__Instance = Marshal.AllocHGlobal(104);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0((__Instance + __PointerAdjustment));
SetupVTables(GetType().FullName == "CppSharp.CppParser.dll.CppSharp.Parser.AbstractModule");
}
protected AbstractModule(CppSharp.Parser.AbstractModule _0)
{
__Instance = Marshal.AllocHGlobal(104);
__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_1((__Instance + __PointerAdjustment), arg0);
SetupVTables(GetType().FullName == "CppSharp.CppParser.dll.CppSharp.Parser.AbstractModule");
}
public void Dispose()
{
Dispose(disposing: true);
}
protected virtual void Dispose(bool disposing)
{
CppSharp.Parser.AbstractModule __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
((Internal*) __Instance)->vfptr0 = new global::System.IntPtr(__OriginalVTables[0]);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
}
public string getIncludeDirs(uint i)
{
var __ret = Internal.getIncludeDirs_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addIncludeDirs(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addIncludeDirs_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearIncludeDirs()
{
Internal.clearIncludeDirs_0((__Instance + __PointerAdjustment));
}
public string getLibraryDirs(uint i)
{
var __ret = Internal.getLibraryDirs_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addLibraryDirs(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addLibraryDirs_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearLibraryDirs()
{
Internal.clearLibraryDirs_0((__Instance + __PointerAdjustment));
}
public string getDefines(uint i)
{
var __ret = Internal.getDefines_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addDefines(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addDefines_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearDefines()
{
Internal.clearDefines_0((__Instance + __PointerAdjustment));
}
public string getUndefines(uint i)
{
var __ret = Internal.getUndefines_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addUndefines(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addUndefines_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearUndefines()
{
Internal.clearUndefines_0((__Instance + __PointerAdjustment));
}
public uint IncludeDirsCount
{
get
{
var __ret = Internal.getIncludeDirsCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
public uint LibraryDirsCount
{
get
{
var __ret = Internal.getLibraryDirsCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
public uint DefinesCount
{
get
{
var __ret = Internal.getDefinesCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
public uint UndefinesCount
{
get
{
var __ret = Internal.getUndefinesCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
#region Virtual table interop
// virtual ~AbstractModule() = 0
private static Delegates.Action_IntPtr _dtor_0DelegateInstance;
private static void _dtor_0DelegateHook(global::System.IntPtr instance)
{
if (!NativeToManagedMap.ContainsKey(instance))
throw new global::System.Exception("No managed instance was found");
var __target = (AbstractModule) NativeToManagedMap[instance];
if (__target.__ownsNativeInstance)
__target.SetupVTables();
__target.Dispose(false);
}
private static void*[] __ManagedVTables;
private static void*[] __ManagedVTablesDtorOnly;
private static void*[] _Thunks;
private void SetupVTables(bool destructorOnly = false)
{
if (__OriginalVTables != null)
return;
var native = (Internal*) __Instance.ToPointer();
__OriginalVTables = new void*[] { ((Internal*) native)->vfptr0.ToPointer() };
if (_Thunks == null)
{
_Thunks = new void*[1];
_dtor_0DelegateInstance += _dtor_0DelegateHook;
_Thunks[0] = Marshal.GetFunctionPointerForDelegate(_dtor_0DelegateInstance).ToPointer();
}
if (destructorOnly)
{
if (__ManagedVTablesDtorOnly == null)
{
__ManagedVTablesDtorOnly = new void*[1];
var vtptr = Marshal.AllocHGlobal(4 * 8);
var vfptr0 = vtptr + 2 * 8;
__ManagedVTablesDtorOnly[0] = vfptr0.ToPointer();
*(void**)(vfptr0 + -16) = *(void**)(native->vfptr0 + -16);
*(void**)(vfptr0 + -8) = *(void**)(native->vfptr0 + -8);
*(void**)(vfptr0 + 0) = *(void**)(native->vfptr0 + 0);
*(void**)(vfptr0 + 8) = _Thunks[0];
}
native->vfptr0 = new IntPtr(__ManagedVTablesDtorOnly[0]);
}
else
{
if (__ManagedVTables == null)
{
__ManagedVTables = new void*[1];
var vtptr = Marshal.AllocHGlobal(4 * 8);
var vfptr0 = vtptr + 2 * 8;
__ManagedVTables[0] = vfptr0.ToPointer();
*(void**)(vfptr0 + -16) = *(void**)(native->vfptr0 + -16);
*(void**)(vfptr0 + -8) = *(void**)(native->vfptr0 + -8);
*(void**)(vfptr0 + 0) = *(void**)(native->vfptr0 + 0);
*(void**)(vfptr0 + 8) = _Thunks[0];
}
native->vfptr0 = new IntPtr(__ManagedVTables[0]);
}
}
#endregion
}
public unsafe partial class ParserOptions : IDisposable public unsafe partial class ParserOptions : IDisposable
{ {
[StructLayout(LayoutKind.Explicit, Size = 200)] [StructLayout(LayoutKind.Explicit, Size = 208)]
public partial struct Internal public partial struct Internal
{ {
[FieldOffset(152)] [FieldOffset(152)]
@ -79,6 +420,9 @@ namespace CppSharp
[FieldOffset(192)] [FieldOffset(192)]
public global::System.IntPtr TargetInfo; public global::System.IntPtr TargetInfo;
[FieldOffset(200)]
public global::System.IntPtr Module;
[SuppressUnmanagedCodeSecurity] [SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="_ZN8CppSharp9CppParser13ParserOptionsC2Ev")] EntryPoint="_ZN8CppSharp9CppParser13ParserOptionsC2Ev")]
@ -255,7 +599,7 @@ namespace CppSharp
private static void* __CopyValue(ParserOptions.Internal native) private static void* __CopyValue(ParserOptions.Internal native)
{ {
var ret = Marshal.AllocHGlobal(200); var ret = Marshal.AllocHGlobal(208);
CppSharp.Parser.ParserOptions.Internal.cctor_1(ret, new global::System.IntPtr(&native)); CppSharp.Parser.ParserOptions.Internal.cctor_1(ret, new global::System.IntPtr(&native));
return ret.ToPointer(); return ret.ToPointer();
} }
@ -276,7 +620,7 @@ namespace CppSharp
public ParserOptions() public ParserOptions()
{ {
__Instance = Marshal.AllocHGlobal(200); __Instance = Marshal.AllocHGlobal(208);
__ownsNativeInstance = true; __ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this; NativeToManagedMap[__Instance] = this;
Internal.ctor_0((__Instance + __PointerAdjustment)); Internal.ctor_0((__Instance + __PointerAdjustment));
@ -284,7 +628,7 @@ namespace CppSharp
public ParserOptions(CppSharp.Parser.ParserOptions _0) public ParserOptions(CppSharp.Parser.ParserOptions _0)
{ {
__Instance = Marshal.AllocHGlobal(200); __Instance = Marshal.AllocHGlobal(208);
__ownsNativeInstance = true; __ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this; NativeToManagedMap[__Instance] = this;
if (ReferenceEquals(_0, null)) if (ReferenceEquals(_0, null))
@ -627,6 +971,24 @@ namespace CppSharp
((Internal*) __Instance)->TargetInfo = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance; ((Internal*) __Instance)->TargetInfo = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
} }
} }
public CppSharp.Parser.AbstractModule Module
{
get
{
CppSharp.Parser.AbstractModule __result0;
if (((Internal*) __Instance)->Module == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AbstractModule.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->Module))
__result0 = (CppSharp.Parser.AbstractModule) CppSharp.Parser.AbstractModule.NativeToManagedMap[((Internal*) __Instance)->Module];
else CppSharp.Parser.AbstractModule.NativeToManagedMap[((Internal*) __Instance)->Module] = __result0 = (CppSharp.Parser.AbstractModule) CppSharp.Parser.AbstractModule.__CreateInstance(((Internal*) __Instance)->Module);
return __result0;
}
set
{
((Internal*) __Instance)->Module = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
}
}
} }
public unsafe partial class ParserDiagnostic : IDisposable public unsafe partial class ParserDiagnostic : IDisposable
@ -1156,5 +1518,30 @@ namespace CppSharp
return __result0; return __result0;
} }
} }
internal unsafe partial class AbstractModuleInternal : CppSharp.Parser.AbstractModule, IDisposable
{
private static void* __CopyValue(AbstractModule.Internal native)
{
var ret = Marshal.AllocHGlobal(104);
*(AbstractModule.Internal*) ret = native;
return ret.ToPointer();
}
internal AbstractModuleInternal(AbstractModule.Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
internal AbstractModuleInternal(void* native, bool skipVTables = false)
: base((void*) null)
{
__PointerAdjustment = 0;
__Instance = new global::System.IntPtr(native);
__OriginalVTables = new void*[] { ((Internal*) native)->vfptr0.ToPointer() };
}
}
} }
} }

351
src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppParser.cs

@ -1,8 +1,6 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// <auto-generated>
// This is autogenerated code by CppSharp. // This is autogenerated code by CppSharp.
// Do not edit this file or all your changes will be lost after re-generation. // Do not edit this file or all your changes will be lost after re-generation.
// </auto-generated>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -47,9 +45,304 @@ namespace CppSharp
User = 4 User = 4
} }
public unsafe abstract partial class AbstractModule : IDisposable
{
[StructLayout(LayoutKind.Explicit, Size = 104)]
public partial struct Internal
{
[FieldOffset(0)]
public global::System.IntPtr vfptr0;
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="??0AbstractModule@CppParser@CppSharp@@QEAA@XZ")]
internal static extern global::System.IntPtr ctor_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="??0AbstractModule@CppParser@CppSharp@@QEAA@AEBV012@@Z")]
internal static extern global::System.IntPtr cctor_1(global::System.IntPtr instance, global::System.IntPtr _0);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?getIncludeDirs@AbstractModule@CppParser@CppSharp@@QEAAPEBDI@Z")]
internal static extern global::System.IntPtr getIncludeDirs_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?addIncludeDirs@AbstractModule@CppParser@CppSharp@@QEAAXPEBD@Z")]
internal static extern void addIncludeDirs_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?clearIncludeDirs@AbstractModule@CppParser@CppSharp@@QEAAXXZ")]
internal static extern void clearIncludeDirs_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?getLibraryDirs@AbstractModule@CppParser@CppSharp@@QEAAPEBDI@Z")]
internal static extern global::System.IntPtr getLibraryDirs_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?addLibraryDirs@AbstractModule@CppParser@CppSharp@@QEAAXPEBD@Z")]
internal static extern void addLibraryDirs_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?clearLibraryDirs@AbstractModule@CppParser@CppSharp@@QEAAXXZ")]
internal static extern void clearLibraryDirs_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?getDefines@AbstractModule@CppParser@CppSharp@@QEAAPEBDI@Z")]
internal static extern global::System.IntPtr getDefines_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?addDefines@AbstractModule@CppParser@CppSharp@@QEAAXPEBD@Z")]
internal static extern void addDefines_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?clearDefines@AbstractModule@CppParser@CppSharp@@QEAAXXZ")]
internal static extern void clearDefines_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?getUndefines@AbstractModule@CppParser@CppSharp@@QEAAPEBDI@Z")]
internal static extern global::System.IntPtr getUndefines_0(global::System.IntPtr instance, uint i);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?addUndefines@AbstractModule@CppParser@CppSharp@@QEAAXPEBD@Z")]
internal static extern void addUndefines_0(global::System.IntPtr instance, global::System.IntPtr s);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?clearUndefines@AbstractModule@CppParser@CppSharp@@QEAAXXZ")]
internal static extern void clearUndefines_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?getIncludeDirsCount@AbstractModule@CppParser@CppSharp@@QEAAIXZ")]
internal static extern uint getIncludeDirsCount_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?getLibraryDirsCount@AbstractModule@CppParser@CppSharp@@QEAAIXZ")]
internal static extern uint getLibraryDirsCount_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?getDefinesCount@AbstractModule@CppParser@CppSharp@@QEAAIXZ")]
internal static extern uint getDefinesCount_0(global::System.IntPtr instance);
[SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="?getUndefinesCount@AbstractModule@CppParser@CppSharp@@QEAAIXZ")]
internal static extern uint getUndefinesCount_0(global::System.IntPtr instance);
}
public global::System.IntPtr __Instance { get; protected set; }
protected int __PointerAdjustment;
public static readonly System.Collections.Concurrent.ConcurrentDictionary<IntPtr, AbstractModule> NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary<IntPtr, AbstractModule>();
protected void*[] __OriginalVTables;
protected bool __ownsNativeInstance;
public static AbstractModule __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
{
return new AbstractModuleInternal(native.ToPointer(), skipVTables);
}
public static AbstractModule __CreateInstance(AbstractModule.Internal native, bool skipVTables = false)
{
return new AbstractModuleInternal(native, skipVTables);
}
protected AbstractModule(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
if (skipVTables)
__OriginalVTables = new void*[] { ((Internal*) native)->vfptr0.ToPointer() };
else
SetupVTables(true);
}
protected AbstractModule()
{
__Instance = Marshal.AllocHGlobal(104);
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
Internal.ctor_0((__Instance + __PointerAdjustment));
SetupVTables(GetType().FullName == "CppSharp.CppParser.dll.CppSharp.Parser.AbstractModule");
}
protected AbstractModule(CppSharp.Parser.AbstractModule _0)
{
__Instance = Marshal.AllocHGlobal(104);
__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_1((__Instance + __PointerAdjustment), arg0);
SetupVTables(GetType().FullName == "CppSharp.CppParser.dll.CppSharp.Parser.AbstractModule");
}
public void Dispose()
{
Dispose(disposing: true);
}
protected virtual void Dispose(bool disposing)
{
CppSharp.Parser.AbstractModule __dummy;
NativeToManagedMap.TryRemove(__Instance, out __dummy);
((Internal*) __Instance)->vfptr0 = new global::System.IntPtr(__OriginalVTables[0]);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
}
public string getIncludeDirs(uint i)
{
var __ret = Internal.getIncludeDirs_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addIncludeDirs(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addIncludeDirs_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearIncludeDirs()
{
Internal.clearIncludeDirs_0((__Instance + __PointerAdjustment));
}
public string getLibraryDirs(uint i)
{
var __ret = Internal.getLibraryDirs_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addLibraryDirs(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addLibraryDirs_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearLibraryDirs()
{
Internal.clearLibraryDirs_0((__Instance + __PointerAdjustment));
}
public string getDefines(uint i)
{
var __ret = Internal.getDefines_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addDefines(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addDefines_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearDefines()
{
Internal.clearDefines_0((__Instance + __PointerAdjustment));
}
public string getUndefines(uint i)
{
var __ret = Internal.getUndefines_0((__Instance + __PointerAdjustment), i);
return Marshal.PtrToStringAnsi(__ret);
}
public void addUndefines(string s)
{
var arg0 = Marshal.StringToHGlobalAnsi(s);
Internal.addUndefines_0((__Instance + __PointerAdjustment), arg0);
Marshal.FreeHGlobal(arg0);
}
public void clearUndefines()
{
Internal.clearUndefines_0((__Instance + __PointerAdjustment));
}
public uint IncludeDirsCount
{
get
{
var __ret = Internal.getIncludeDirsCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
public uint LibraryDirsCount
{
get
{
var __ret = Internal.getLibraryDirsCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
public uint DefinesCount
{
get
{
var __ret = Internal.getDefinesCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
public uint UndefinesCount
{
get
{
var __ret = Internal.getUndefinesCount_0((__Instance + __PointerAdjustment));
return __ret;
}
}
#region Virtual table interop
private static void _dtor_0DelegateHook(global::System.IntPtr instance, int delete)
{
if (!NativeToManagedMap.ContainsKey(instance))
throw new global::System.Exception("No managed instance was found");
var __target = (AbstractModule) NativeToManagedMap[instance];
if (__target.__ownsNativeInstance)
__target.SetupVTables();
__target.Dispose(false);
}
private static void*[] __ManagedVTables;
private static void*[] __ManagedVTablesDtorOnly;
private static void*[] _Thunks;
private void SetupVTables(bool destructorOnly = false)
{
}
#endregion
}
public unsafe partial class ParserOptions : IDisposable public unsafe partial class ParserOptions : IDisposable
{ {
[StructLayout(LayoutKind.Explicit, Size = 248)] [StructLayout(LayoutKind.Explicit, Size = 256)]
public partial struct Internal public partial struct Internal
{ {
[FieldOffset(176)] [FieldOffset(176)]
@ -79,6 +372,9 @@ namespace CppSharp
[FieldOffset(240)] [FieldOffset(240)]
public global::System.IntPtr TargetInfo; public global::System.IntPtr TargetInfo;
[FieldOffset(248)]
public global::System.IntPtr Module;
[SuppressUnmanagedCodeSecurity] [SuppressUnmanagedCodeSecurity]
[DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl, [DllImport("CppSharp.CppParser.dll", CallingConvention = global::System.Runtime.InteropServices.CallingConvention.Cdecl,
EntryPoint="??0ParserOptions@CppParser@CppSharp@@QEAA@XZ")] EntryPoint="??0ParserOptions@CppParser@CppSharp@@QEAA@XZ")]
@ -255,7 +551,7 @@ namespace CppSharp
private static void* __CopyValue(ParserOptions.Internal native) private static void* __CopyValue(ParserOptions.Internal native)
{ {
var ret = Marshal.AllocHGlobal(248); var ret = Marshal.AllocHGlobal(256);
CppSharp.Parser.ParserOptions.Internal.cctor_2(ret, new global::System.IntPtr(&native)); CppSharp.Parser.ParserOptions.Internal.cctor_2(ret, new global::System.IntPtr(&native));
return ret.ToPointer(); return ret.ToPointer();
} }
@ -276,7 +572,7 @@ namespace CppSharp
public ParserOptions() public ParserOptions()
{ {
__Instance = Marshal.AllocHGlobal(248); __Instance = Marshal.AllocHGlobal(256);
__ownsNativeInstance = true; __ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this; NativeToManagedMap[__Instance] = this;
Internal.ctor_0((__Instance + __PointerAdjustment)); Internal.ctor_0((__Instance + __PointerAdjustment));
@ -284,7 +580,7 @@ namespace CppSharp
public ParserOptions(CppSharp.Parser.ParserOptions _0) public ParserOptions(CppSharp.Parser.ParserOptions _0)
{ {
__Instance = Marshal.AllocHGlobal(248); __Instance = Marshal.AllocHGlobal(256);
__ownsNativeInstance = true; __ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this; NativeToManagedMap[__Instance] = this;
if (ReferenceEquals(_0, null)) if (ReferenceEquals(_0, null))
@ -627,6 +923,24 @@ namespace CppSharp
((Internal*) __Instance)->TargetInfo = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance; ((Internal*) __Instance)->TargetInfo = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
} }
} }
public CppSharp.Parser.AbstractModule Module
{
get
{
CppSharp.Parser.AbstractModule __result0;
if (((Internal*) __Instance)->Module == IntPtr.Zero) __result0 = null;
else if (CppSharp.Parser.AbstractModule.NativeToManagedMap.ContainsKey(((Internal*) __Instance)->Module))
__result0 = (CppSharp.Parser.AbstractModule) CppSharp.Parser.AbstractModule.NativeToManagedMap[((Internal*) __Instance)->Module];
else CppSharp.Parser.AbstractModule.NativeToManagedMap[((Internal*) __Instance)->Module] = __result0 = (CppSharp.Parser.AbstractModule) CppSharp.Parser.AbstractModule.__CreateInstance(((Internal*) __Instance)->Module);
return __result0;
}
set
{
((Internal*) __Instance)->Module = ReferenceEquals(value, null) ? global::System.IntPtr.Zero : value.__Instance;
}
}
} }
public unsafe partial class ParserDiagnostic : IDisposable public unsafe partial class ParserDiagnostic : IDisposable
@ -1156,5 +1470,30 @@ namespace CppSharp
return __result0; return __result0;
} }
} }
internal unsafe partial class AbstractModuleInternal : CppSharp.Parser.AbstractModule, IDisposable
{
private static void* __CopyValue(AbstractModule.Internal native)
{
var ret = Marshal.AllocHGlobal(104);
*(AbstractModule.Internal*) ret = native;
return ret.ToPointer();
}
internal AbstractModuleInternal(AbstractModule.Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
internal AbstractModuleInternal(void* native, bool skipVTables = false)
: base((void*) null)
{
__PointerAdjustment = 0;
__Instance = new global::System.IntPtr(native);
__OriginalVTables = new void*[] { ((Internal*) native)->vfptr0.ToPointer() };
}
}
} }
} }

6
src/CppParser/Bindings/ParserGen.cs

@ -71,8 +71,8 @@ namespace CppSharp
SetupLinuxOptions(options); SetupLinuxOptions(options);
var basePath = Path.Combine(GetSourceDirectory("src"), "CppParser"); var basePath = Path.Combine(GetSourceDirectory("src"), "CppParser");
options.addIncludeDirs(basePath); options.Module.addIncludeDirs(basePath);
options.addLibraryDirs("."); options.Module.addLibraryDirs(".");
options.OutputDir = Path.Combine(GetSourceDirectory("src"), "CppParser", options.OutputDir = Path.Combine(GetSourceDirectory("src"), "CppParser",
"Bindings", Kind.ToString()); "Bindings", Kind.ToString());
@ -89,7 +89,7 @@ namespace CppSharp
options.MicrosoftMode = false; options.MicrosoftMode = false;
options.NoBuiltinIncludes = true; options.NoBuiltinIncludes = true;
string[] sysincdirs = new[] { string[] sysincdirs = {
"/usr/include/c++/4.8", "/usr/include/c++/4.8",
"/usr/include/x86_64-linux-gnu/c++/4.8", "/usr/include/x86_64-linux-gnu/c++/4.8",
"/usr/include/c++/4.8/backward", "/usr/include/c++/4.8/backward",

18
src/CppParser/CppParser.cpp

@ -10,6 +10,19 @@
namespace CppSharp { namespace CppParser { namespace CppSharp { namespace CppParser {
AbstractModule::AbstractModule()
{
}
AbstractModule::~AbstractModule()
{
}
DEF_VECTOR_STRING(AbstractModule, IncludeDirs)
DEF_VECTOR_STRING(AbstractModule, LibraryDirs)
DEF_VECTOR_STRING(AbstractModule, Defines)
DEF_VECTOR_STRING(AbstractModule, Undefines)
ParserOptions::ParserOptions() ParserOptions::ParserOptions()
: ASTContext(0) : ASTContext(0)
, ToolSetToUse(0) , ToolSetToUse(0)
@ -20,16 +33,13 @@ ParserOptions::ParserOptions()
, Verbose(false) , Verbose(false)
, LanguageVersion(CppParser::LanguageVersion::CPlusPlus11) , LanguageVersion(CppParser::LanguageVersion::CPlusPlus11)
, TargetInfo(0) , TargetInfo(0)
, Module(0)
{ {
} }
DEF_VECTOR_STRING(ParserOptions, Arguments) DEF_VECTOR_STRING(ParserOptions, Arguments)
DEF_STRING(ParserOptions, FileName) DEF_STRING(ParserOptions, FileName)
DEF_VECTOR_STRING(ParserOptions, IncludeDirs)
DEF_VECTOR_STRING(ParserOptions, SystemIncludeDirs) DEF_VECTOR_STRING(ParserOptions, SystemIncludeDirs)
DEF_VECTOR_STRING(ParserOptions, Defines)
DEF_VECTOR_STRING(ParserOptions, Undefines)
DEF_VECTOR_STRING(ParserOptions, LibraryDirs)
DEF_STRING(ParserOptions, TargetTriple) DEF_STRING(ParserOptions, TargetTriple)
DEF_STRING(ParserTargetInfo, ABI) DEF_STRING(ParserTargetInfo, ABI)

17
src/CppParser/CppParser.h

@ -31,6 +31,17 @@ enum class LanguageVersion
CPlusPlus11 CPlusPlus11
}; };
class CS_API AbstractModule
{
public:
AbstractModule();
VECTOR_STRING(IncludeDirs)
VECTOR_STRING(LibraryDirs)
VECTOR_STRING(Defines)
VECTOR_STRING(Undefines)
~AbstractModule();
};
struct CS_API ParserOptions struct CS_API ParserOptions
{ {
ParserOptions(); ParserOptions();
@ -41,11 +52,7 @@ struct CS_API ParserOptions
STRING(FileName) STRING(FileName)
// Include directories // Include directories
VECTOR_STRING(IncludeDirs)
VECTOR_STRING(SystemIncludeDirs) VECTOR_STRING(SystemIncludeDirs)
VECTOR_STRING(Defines)
VECTOR_STRING(Undefines)
VECTOR_STRING(LibraryDirs)
CppSharp::CppParser::AST::ASTContext* ASTContext; CppSharp::CppParser::AST::ASTContext* ASTContext;
@ -60,6 +67,8 @@ struct CS_API ParserOptions
LanguageVersion LanguageVersion; LanguageVersion LanguageVersion;
ParserTargetInfo* TargetInfo; ParserTargetInfo* TargetInfo;
AbstractModule* Module;
}; };
enum class ParserDiagnosticLevel enum class ParserDiagnosticLevel

22
src/CppParser/Parser.cpp

@ -159,7 +159,7 @@ void Parser::SetupHeader()
for (unsigned I = 0, E = Opts->Arguments.size(); I != E; ++I) for (unsigned I = 0, E = Opts->Arguments.size(); I != E; ++I)
{ {
const String& Arg = Opts->Arguments[I]; const auto& Arg = Opts->Arguments[I];
args.push_back(Arg.c_str()); args.push_back(Arg.c_str());
} }
@ -210,27 +210,27 @@ void Parser::SetupHeader()
if (Opts->Verbose) if (Opts->Verbose)
HSOpts.Verbose = true; HSOpts.Verbose = true;
for (unsigned I = 0, E = Opts->IncludeDirs.size(); I != E; ++I) for (unsigned I = 0, E = Opts->Module->IncludeDirs.size(); I != E; ++I)
{ {
const String& s = Opts->IncludeDirs[I]; const auto& s = Opts->Module->IncludeDirs[I];
HSOpts.AddPath(s, frontend::Angled, false, false); HSOpts.AddPath(s, frontend::Angled, false, false);
} }
for (unsigned I = 0, E = Opts->SystemIncludeDirs.size(); I != E; ++I) for (unsigned I = 0, E = Opts->SystemIncludeDirs.size(); I != E; ++I)
{ {
String s = Opts->SystemIncludeDirs[I]; const auto& s = Opts->SystemIncludeDirs[I];
HSOpts.AddPath(s, frontend::System, false, false); HSOpts.AddPath(s, frontend::System, false, false);
} }
for (unsigned I = 0, E = Opts->Defines.size(); I != E; ++I) for (unsigned I = 0, E = Opts->Module->Defines.size(); I != E; ++I)
{ {
const String& define = Opts->Defines[I]; const auto& define = Opts->Module->Defines[I];
PPOpts.addMacroDef(define); PPOpts.addMacroDef(define);
} }
for (unsigned I = 0, E = Opts->Undefines.size(); I != E; ++I) for (unsigned I = 0, E = Opts->Module->Undefines.size(); I != E; ++I)
{ {
const String& undefine = Opts->Undefines[I]; const auto& undefine = Opts->Module->Undefines[I];
PPOpts.addMacroUndef(undefine); PPOpts.addMacroUndef(undefine);
} }
@ -2334,7 +2334,7 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, Function* F,
F->ReturnType = GetQualifiedType(FD->getReturnType(), F->ReturnType = GetQualifiedType(FD->getReturnType(),
WalkType(FD->getReturnType(), &RTL)); WalkType(FD->getReturnType(), &RTL));
String Mangled = GetDeclMangledName(FD); const auto& Mangled = GetDeclMangledName(FD);
F->Mangled = Mangled; F->Mangled = Mangled;
clang::SourceLocation ParamStartLoc = FD->getLocStart(); clang::SourceLocation ParamStartLoc = FD->getLocStart();
@ -3476,9 +3476,9 @@ ParserResult* Parser::ParseLibrary(const std::string& File, ParserResult* res)
llvm::StringRef FileEntry; llvm::StringRef FileEntry;
for (unsigned I = 0, E = Opts->LibraryDirs.size(); I != E; ++I) for (unsigned I = 0, E = Opts->Module->LibraryDirs.size(); I != E; ++I)
{ {
auto& LibDir = Opts->LibraryDirs[I]; auto& LibDir = Opts->Module->LibraryDirs[I];
llvm::SmallString<256> Path(LibDir); llvm::SmallString<256> Path(LibDir);
llvm::sys::path::append(Path, File); llvm::sys::path::append(Path, File);

1
src/CppParser/Parser.h

@ -21,7 +21,6 @@
#include "CppParser.h" #include "CppParser.h"
#include <string> #include <string>
typedef std::string String;
namespace clang { namespace clang {
namespace CodeGen { namespace CodeGen {

6
src/Generator/Module.cs

@ -1,8 +1,12 @@
using System.Collections.Generic; using System.Collections.Generic;
using CppSharp.Parser;
namespace CppSharp namespace CppSharp
{ {
public class Module /// <summary>
/// Contains sets of headers and optionally libraries to wrap in a one target library.
/// </summary>
public class Module : AbstractModule
{ {
public Module() public Module()
{ {

26
src/Generator/Options.cs

@ -60,23 +60,21 @@ namespace CppSharp
public bool DryRun; public bool DryRun;
// Parser options // Parser options
public List<string> Headers { get { return Module.Headers; } } public List<string> Headers { get { return ((Module) Module).Headers; } }
public bool IgnoreParseWarnings; public bool IgnoreParseWarnings;
public bool IgnoreParseErrors; public bool IgnoreParseErrors;
public Module Module { get; set; }
public bool IsItaniumLikeAbi { get { return Abi != CppAbi.Microsoft; } } public bool IsItaniumLikeAbi { get { return Abi != CppAbi.Microsoft; } }
public bool IsMicrosoftAbi { get { return Abi == CppAbi.Microsoft; } } public bool IsMicrosoftAbi { get { return Abi == CppAbi.Microsoft; } }
// Library options // Library options
public List<string> Libraries { get { return Module.Libraries; } } public List<string> Libraries { get { return ((Module) Module).Libraries; } }
public bool CheckSymbols; public bool CheckSymbols;
public string SharedLibraryName public string SharedLibraryName
{ {
get { return Module.SharedLibraryName; } get { return ((Module) Module).SharedLibraryName; }
set { Module.SharedLibraryName = value; } set { ((Module) Module).SharedLibraryName = value; }
} }
// Generator options // Generator options
@ -84,16 +82,16 @@ namespace CppSharp
public string OutputNamespace public string OutputNamespace
{ {
get { return Module.OutputNamespace; } get { return ((Module) Module).OutputNamespace; }
set { Module.OutputNamespace = value; } set { ((Module) Module).OutputNamespace = value; }
} }
public string OutputDir; public string OutputDir;
public string LibraryName public string LibraryName
{ {
get { return Module.LibraryName; } get { return ((Module) Module).LibraryName; }
set { Module.LibraryName = value; } set { ((Module) Module).LibraryName = value; }
} }
public bool OutputInteropIncludes; public bool OutputInteropIncludes;
@ -158,14 +156,14 @@ namespace CppSharp
public string InlinesLibraryName public string InlinesLibraryName
{ {
get { return Module.InlinesLibraryName; } get { return ((Module) Module).InlinesLibraryName; }
set { Module.InlinesLibraryName = value; } set { ((Module) Module).InlinesLibraryName = value; }
} }
public string TemplatesLibraryName public string TemplatesLibraryName
{ {
get { return Module.TemplatesLibraryName; } get { return ((Module) Module).TemplatesLibraryName; }
set { Module.TemplatesLibraryName = value; } set { ((Module) Module).TemplatesLibraryName = value; }
} }
public bool IsCSharpGenerator public bool IsCSharpGenerator

Loading…
Cancel
Save