From db48555349fff8fbbb0c320b3f4889a962c53fb6 Mon Sep 17 00:00:00 2001 From: Redux <120261066+kumja1@users.noreply.github.com> Date: Mon, 2 Sep 2024 19:56:10 +0000 Subject: [PATCH] upd: char marshalling for libraryimport --- CppSharp.code-workspace | 2 +- .../CppSharp.CppParser.cs | 28 +++---- .../CSharp/i686-apple-darwin12.4.0/Std.cs | 2 +- .../i686-pc-win32-msvc/CppSharp.CppParser.cs | 28 +++---- .../Bindings/CSharp/i686-pc-win32-msvc/Std.cs | 2 +- .../CppSharp.CppParser.cs | 28 +++---- .../CSharp/x86_64-apple-darwin12.4.0/Std.cs | 2 +- .../CppSharp.CppParser.cs | 28 +++---- .../CSharp/x86_64-linux-gnu-cxx11abi/Std.cs | 2 +- .../x86_64-linux-gnu/CppSharp.CppParser.cs | 28 +++---- .../Bindings/CSharp/x86_64-linux-gnu/Std.cs | 2 +- .../CppSharp.CppParser.cs | 28 +++---- .../CSharp/x86_64-pc-win32-msvc/Std.cs | 2 +- .../Generators/CSharp/CSharpSources.cs | 36 ++++---- .../Generators/CSharp/CSharpTypePrinter.cs | 25 ++++-- src/Generator/Options.cs | 35 ++++---- src/Generator/Types/Std/Stdlib.CSharp.cs | 4 +- src/Runtime/CppSharp.Runtime.csproj | 2 +- src/Runtime/UTF32Marshaller.cs | 83 ++++++++++++++----- src/Runtime/UTF8Marshaller.cs | 71 +++++++++++++--- 20 files changed, 272 insertions(+), 166 deletions(-) diff --git a/CppSharp.code-workspace b/CppSharp.code-workspace index b7ebfbd50f..e2e8f3b762 100644 --- a/CppSharp.code-workspace +++ b/CppSharp.code-workspace @@ -5,7 +5,6 @@ } ], "settings": { - "omnisharp.defaultLaunchSolution": "build/vs2019/CppSharp.sln", "vssolution.altSolutionFolders": [ "build/vs2019" ], @@ -105,5 +104,6 @@ "filesystem": "cpp", "__memory": "cpp" }, + "dotnet.defaultSolution": "build/vs2019/CppSharp.sln", }, } \ No newline at end of file diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs index c12579c6ca..bfddbe5e3a 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs @@ -83,7 +83,7 @@ public partial struct __Internal internal static extern __IntPtr GetSymbols(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary10addSymbolsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSymbols(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSymbols(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary12clearSymbolsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSymbols(__IntPtr __instance); @@ -92,7 +92,7 @@ public partial struct __Internal internal static extern __IntPtr GetDependencies(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary15addDependenciesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddDependencies(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddDependencies(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary17clearDependenciesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearDependencies(__IntPtr __instance); @@ -40502,7 +40502,7 @@ public partial struct __Internal internal static extern __IntPtr GetArguments(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions12addArgumentsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14clearArgumentsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearArguments(__IntPtr __instance); @@ -40511,7 +40511,7 @@ public partial struct __Internal internal static extern __IntPtr GetCompilationOptions(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions21addCompilationOptionsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddCompilationOptions(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddCompilationOptions(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions23clearCompilationOptionsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearCompilationOptions(__IntPtr __instance); @@ -40520,7 +40520,7 @@ public partial struct __Internal internal static extern __IntPtr GetSourceFiles(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14addSourceFilesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSourceFiles(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSourceFiles(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions16clearSourceFilesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSourceFiles(__IntPtr __instance); @@ -40529,7 +40529,7 @@ public partial struct __Internal internal static extern __IntPtr GetIncludeDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14addIncludeDirsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions16clearIncludeDirsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearIncludeDirs(__IntPtr __instance); @@ -40538,7 +40538,7 @@ public partial struct __Internal internal static extern __IntPtr GetSystemIncludeDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions20addSystemIncludeDirsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSystemIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSystemIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions22clearSystemIncludeDirsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSystemIncludeDirs(__IntPtr __instance); @@ -40547,7 +40547,7 @@ public partial struct __Internal internal static extern __IntPtr GetDefines(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions10addDefinesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddDefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddDefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions12clearDefinesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearDefines(__IntPtr __instance); @@ -40556,7 +40556,7 @@ public partial struct __Internal internal static extern __IntPtr GetUndefines(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions12addUndefinesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddUndefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddUndefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14clearUndefinesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearUndefines(__IntPtr __instance); @@ -40565,7 +40565,7 @@ public partial struct __Internal internal static extern __IntPtr GetSupportedStdTypes(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions20addSupportedStdTypesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSupportedStdTypes(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSupportedStdTypes(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions22clearSupportedStdTypesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSupportedStdTypes(__IntPtr __instance); @@ -40574,7 +40574,7 @@ public partial struct __Internal internal static extern __IntPtr GetSupportedFunctionTemplates(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions29addSupportedFunctionTemplatesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSupportedFunctionTemplates(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSupportedFunctionTemplates(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions31clearSupportedFunctionTemplatesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSupportedFunctionTemplates(__IntPtr __instance); @@ -41118,7 +41118,7 @@ public partial struct __Internal internal static extern __IntPtr GetArguments(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions12addArgumentsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions14clearArgumentsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearArguments(__IntPtr __instance); @@ -41127,7 +41127,7 @@ public partial struct __Internal internal static extern __IntPtr GetLibraryDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions14addLibraryDirsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddLibraryDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddLibraryDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions16clearLibraryDirsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearLibraryDirs(__IntPtr __instance); @@ -41136,7 +41136,7 @@ public partial struct __Internal internal static extern __IntPtr GetLibraries(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions12addLibrariesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddLibraries(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddLibraries(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions14clearLibrariesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearLibraries(__IntPtr __instance); diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs index f6c861347f..49aed11cbe 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs @@ -520,7 +520,7 @@ public unsafe static partial class BasicStringExtensions public partial struct __Internal { [SuppressUnmanagedCodeSecurity, DllImport("Std-symbols", EntryPoint = "_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern __IntPtr Assign(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string __s); + internal static extern __IntPtr Assign(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string __s); [SuppressUnmanagedCodeSecurity, DllImport("Std-symbols", EntryPoint = "_ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4dataEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern __IntPtr Data(__IntPtr __instance); diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs index 929151367b..595240ae5d 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs @@ -83,7 +83,7 @@ public partial struct __Internal internal static extern __IntPtr GetSymbols(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addSymbols@NativeLibrary@AST@CppParser@CppSharp@@QAEXPBD@Z", CallingConvention = __CallingConvention.ThisCall)] - internal static extern void AddSymbols(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSymbols(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearSymbols@NativeLibrary@AST@CppParser@CppSharp@@QAEXXZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern void ClearSymbols(__IntPtr __instance); @@ -92,7 +92,7 @@ public partial struct __Internal internal static extern __IntPtr GetDependencies(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addDependencies@NativeLibrary@AST@CppParser@CppSharp@@QAEXPBD@Z", CallingConvention = __CallingConvention.ThisCall)] - internal static extern void AddDependencies(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddDependencies(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearDependencies@NativeLibrary@AST@CppParser@CppSharp@@QAEXXZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern void ClearDependencies(__IntPtr __instance); @@ -40513,7 +40513,7 @@ public partial struct __Internal internal static extern __IntPtr GetArguments(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addArguments@CppParserOptions@CppParser@CppSharp@@QAEXPBD@Z", CallingConvention = __CallingConvention.ThisCall)] - internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearArguments@CppParserOptions@CppParser@CppSharp@@QAEXXZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern void ClearArguments(__IntPtr __instance); @@ -40522,7 +40522,7 @@ public partial struct __Internal internal static extern __IntPtr GetCompilationOptions(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addCompilationOptions@CppParserOptions@CppParser@CppSharp@@QAEXPBD@Z", CallingConvention = __CallingConvention.ThisCall)] - internal static extern void AddCompilationOptions(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddCompilationOptions(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearCompilationOptions@CppParserOptions@CppParser@CppSharp@@QAEXXZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern void ClearCompilationOptions(__IntPtr __instance); @@ -40531,7 +40531,7 @@ public partial struct __Internal internal static extern __IntPtr GetSourceFiles(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addSourceFiles@CppParserOptions@CppParser@CppSharp@@QAEXPBD@Z", CallingConvention = __CallingConvention.ThisCall)] - internal static extern void AddSourceFiles(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSourceFiles(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearSourceFiles@CppParserOptions@CppParser@CppSharp@@QAEXXZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern void ClearSourceFiles(__IntPtr __instance); @@ -40540,7 +40540,7 @@ public partial struct __Internal internal static extern __IntPtr GetIncludeDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addIncludeDirs@CppParserOptions@CppParser@CppSharp@@QAEXPBD@Z", CallingConvention = __CallingConvention.ThisCall)] - internal static extern void AddIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearIncludeDirs@CppParserOptions@CppParser@CppSharp@@QAEXXZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern void ClearIncludeDirs(__IntPtr __instance); @@ -40549,7 +40549,7 @@ public partial struct __Internal internal static extern __IntPtr GetSystemIncludeDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addSystemIncludeDirs@CppParserOptions@CppParser@CppSharp@@QAEXPBD@Z", CallingConvention = __CallingConvention.ThisCall)] - internal static extern void AddSystemIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSystemIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearSystemIncludeDirs@CppParserOptions@CppParser@CppSharp@@QAEXXZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern void ClearSystemIncludeDirs(__IntPtr __instance); @@ -40558,7 +40558,7 @@ public partial struct __Internal internal static extern __IntPtr GetDefines(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addDefines@CppParserOptions@CppParser@CppSharp@@QAEXPBD@Z", CallingConvention = __CallingConvention.ThisCall)] - internal static extern void AddDefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddDefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearDefines@CppParserOptions@CppParser@CppSharp@@QAEXXZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern void ClearDefines(__IntPtr __instance); @@ -40567,7 +40567,7 @@ public partial struct __Internal internal static extern __IntPtr GetUndefines(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addUndefines@CppParserOptions@CppParser@CppSharp@@QAEXPBD@Z", CallingConvention = __CallingConvention.ThisCall)] - internal static extern void AddUndefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddUndefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearUndefines@CppParserOptions@CppParser@CppSharp@@QAEXXZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern void ClearUndefines(__IntPtr __instance); @@ -40576,7 +40576,7 @@ public partial struct __Internal internal static extern __IntPtr GetSupportedStdTypes(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addSupportedStdTypes@CppParserOptions@CppParser@CppSharp@@QAEXPBD@Z", CallingConvention = __CallingConvention.ThisCall)] - internal static extern void AddSupportedStdTypes(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSupportedStdTypes(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearSupportedStdTypes@CppParserOptions@CppParser@CppSharp@@QAEXXZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern void ClearSupportedStdTypes(__IntPtr __instance); @@ -40585,7 +40585,7 @@ public partial struct __Internal internal static extern __IntPtr GetSupportedFunctionTemplates(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addSupportedFunctionTemplates@CppParserOptions@CppParser@CppSharp@@QAEXPBD@Z", CallingConvention = __CallingConvention.ThisCall)] - internal static extern void AddSupportedFunctionTemplates(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSupportedFunctionTemplates(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearSupportedFunctionTemplates@CppParserOptions@CppParser@CppSharp@@QAEXXZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern void ClearSupportedFunctionTemplates(__IntPtr __instance); @@ -41129,7 +41129,7 @@ public partial struct __Internal internal static extern __IntPtr GetArguments(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addArguments@CppLinkerOptions@CppParser@CppSharp@@QAEXPBD@Z", CallingConvention = __CallingConvention.ThisCall)] - internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearArguments@CppLinkerOptions@CppParser@CppSharp@@QAEXXZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern void ClearArguments(__IntPtr __instance); @@ -41138,7 +41138,7 @@ public partial struct __Internal internal static extern __IntPtr GetLibraryDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addLibraryDirs@CppLinkerOptions@CppParser@CppSharp@@QAEXPBD@Z", CallingConvention = __CallingConvention.ThisCall)] - internal static extern void AddLibraryDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddLibraryDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearLibraryDirs@CppLinkerOptions@CppParser@CppSharp@@QAEXXZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern void ClearLibraryDirs(__IntPtr __instance); @@ -41147,7 +41147,7 @@ public partial struct __Internal internal static extern __IntPtr GetLibraries(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addLibraries@CppLinkerOptions@CppParser@CppSharp@@QAEXPBD@Z", CallingConvention = __CallingConvention.ThisCall)] - internal static extern void AddLibraries(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddLibraries(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearLibraries@CppLinkerOptions@CppParser@CppSharp@@QAEXXZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern void ClearLibraries(__IntPtr __instance); diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Std.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Std.cs index e44bd1f9ee..b3e3ebcdbb 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Std.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/Std.cs @@ -463,7 +463,7 @@ public unsafe static partial class BasicStringExtensions public partial struct __Internal { [SuppressUnmanagedCodeSecurity, DllImport("Std-symbols", EntryPoint = "?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@QBD@Z", CallingConvention = __CallingConvention.ThisCall)] - internal static extern __IntPtr Assign(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string _Ptr); + internal static extern __IntPtr Assign(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string _Ptr); [SuppressUnmanagedCodeSecurity, DllImport("Std-symbols", EntryPoint = "?data@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ", CallingConvention = __CallingConvention.ThisCall)] internal static extern __IntPtr Data(__IntPtr __instance); diff --git a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs index 2c6915daa5..dab8430e59 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs @@ -83,7 +83,7 @@ public partial struct __Internal internal static extern __IntPtr GetSymbols(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary10addSymbolsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSymbols(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSymbols(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary12clearSymbolsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSymbols(__IntPtr __instance); @@ -92,7 +92,7 @@ public partial struct __Internal internal static extern __IntPtr GetDependencies(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary15addDependenciesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddDependencies(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddDependencies(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary17clearDependenciesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearDependencies(__IntPtr __instance); @@ -40501,7 +40501,7 @@ public partial struct __Internal internal static extern __IntPtr GetArguments(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions12addArgumentsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14clearArgumentsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearArguments(__IntPtr __instance); @@ -40510,7 +40510,7 @@ public partial struct __Internal internal static extern __IntPtr GetCompilationOptions(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions21addCompilationOptionsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddCompilationOptions(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddCompilationOptions(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions23clearCompilationOptionsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearCompilationOptions(__IntPtr __instance); @@ -40519,7 +40519,7 @@ public partial struct __Internal internal static extern __IntPtr GetSourceFiles(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14addSourceFilesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSourceFiles(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSourceFiles(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions16clearSourceFilesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSourceFiles(__IntPtr __instance); @@ -40528,7 +40528,7 @@ public partial struct __Internal internal static extern __IntPtr GetIncludeDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14addIncludeDirsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions16clearIncludeDirsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearIncludeDirs(__IntPtr __instance); @@ -40537,7 +40537,7 @@ public partial struct __Internal internal static extern __IntPtr GetSystemIncludeDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions20addSystemIncludeDirsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSystemIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSystemIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions22clearSystemIncludeDirsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSystemIncludeDirs(__IntPtr __instance); @@ -40546,7 +40546,7 @@ public partial struct __Internal internal static extern __IntPtr GetDefines(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions10addDefinesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddDefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddDefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions12clearDefinesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearDefines(__IntPtr __instance); @@ -40555,7 +40555,7 @@ public partial struct __Internal internal static extern __IntPtr GetUndefines(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions12addUndefinesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddUndefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddUndefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14clearUndefinesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearUndefines(__IntPtr __instance); @@ -40564,7 +40564,7 @@ public partial struct __Internal internal static extern __IntPtr GetSupportedStdTypes(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions20addSupportedStdTypesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSupportedStdTypes(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSupportedStdTypes(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions22clearSupportedStdTypesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSupportedStdTypes(__IntPtr __instance); @@ -40573,7 +40573,7 @@ public partial struct __Internal internal static extern __IntPtr GetSupportedFunctionTemplates(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions29addSupportedFunctionTemplatesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSupportedFunctionTemplates(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSupportedFunctionTemplates(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions31clearSupportedFunctionTemplatesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSupportedFunctionTemplates(__IntPtr __instance); @@ -41117,7 +41117,7 @@ public partial struct __Internal internal static extern __IntPtr GetArguments(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions12addArgumentsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions14clearArgumentsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearArguments(__IntPtr __instance); @@ -41126,7 +41126,7 @@ public partial struct __Internal internal static extern __IntPtr GetLibraryDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions14addLibraryDirsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddLibraryDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddLibraryDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions16clearLibraryDirsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearLibraryDirs(__IntPtr __instance); @@ -41135,7 +41135,7 @@ public partial struct __Internal internal static extern __IntPtr GetLibraries(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions12addLibrariesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddLibraries(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddLibraries(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions14clearLibrariesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearLibraries(__IntPtr __instance); diff --git a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs index 3f7910977c..4f4a4b56b7 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs @@ -520,7 +520,7 @@ public unsafe static partial class BasicStringExtensions public partial struct __Internal { [SuppressUnmanagedCodeSecurity, DllImport("Std-symbols", EntryPoint = "_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern __IntPtr Assign(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string __s); + internal static extern __IntPtr Assign(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string __s); [SuppressUnmanagedCodeSecurity, DllImport("Std-symbols", EntryPoint = "_ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4dataEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern __IntPtr Data(__IntPtr __instance); diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs index 93855910f0..42a616d68a 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs @@ -83,7 +83,7 @@ public partial struct __Internal internal static extern __IntPtr GetSymbols(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary10addSymbolsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSymbols(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSymbols(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary12clearSymbolsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSymbols(__IntPtr __instance); @@ -92,7 +92,7 @@ public partial struct __Internal internal static extern __IntPtr GetDependencies(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary15addDependenciesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddDependencies(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddDependencies(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary17clearDependenciesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearDependencies(__IntPtr __instance); @@ -40501,7 +40501,7 @@ public partial struct __Internal internal static extern __IntPtr GetArguments(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions12addArgumentsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14clearArgumentsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearArguments(__IntPtr __instance); @@ -40510,7 +40510,7 @@ public partial struct __Internal internal static extern __IntPtr GetCompilationOptions(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions21addCompilationOptionsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddCompilationOptions(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddCompilationOptions(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions23clearCompilationOptionsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearCompilationOptions(__IntPtr __instance); @@ -40519,7 +40519,7 @@ public partial struct __Internal internal static extern __IntPtr GetSourceFiles(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14addSourceFilesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSourceFiles(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSourceFiles(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions16clearSourceFilesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSourceFiles(__IntPtr __instance); @@ -40528,7 +40528,7 @@ public partial struct __Internal internal static extern __IntPtr GetIncludeDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14addIncludeDirsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions16clearIncludeDirsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearIncludeDirs(__IntPtr __instance); @@ -40537,7 +40537,7 @@ public partial struct __Internal internal static extern __IntPtr GetSystemIncludeDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions20addSystemIncludeDirsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSystemIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSystemIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions22clearSystemIncludeDirsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSystemIncludeDirs(__IntPtr __instance); @@ -40546,7 +40546,7 @@ public partial struct __Internal internal static extern __IntPtr GetDefines(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions10addDefinesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddDefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddDefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions12clearDefinesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearDefines(__IntPtr __instance); @@ -40555,7 +40555,7 @@ public partial struct __Internal internal static extern __IntPtr GetUndefines(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions12addUndefinesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddUndefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddUndefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14clearUndefinesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearUndefines(__IntPtr __instance); @@ -40564,7 +40564,7 @@ public partial struct __Internal internal static extern __IntPtr GetSupportedStdTypes(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions20addSupportedStdTypesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSupportedStdTypes(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSupportedStdTypes(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions22clearSupportedStdTypesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSupportedStdTypes(__IntPtr __instance); @@ -40573,7 +40573,7 @@ public partial struct __Internal internal static extern __IntPtr GetSupportedFunctionTemplates(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions29addSupportedFunctionTemplatesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSupportedFunctionTemplates(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSupportedFunctionTemplates(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions31clearSupportedFunctionTemplatesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSupportedFunctionTemplates(__IntPtr __instance); @@ -41117,7 +41117,7 @@ public partial struct __Internal internal static extern __IntPtr GetArguments(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions12addArgumentsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions14clearArgumentsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearArguments(__IntPtr __instance); @@ -41126,7 +41126,7 @@ public partial struct __Internal internal static extern __IntPtr GetLibraryDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions14addLibraryDirsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddLibraryDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddLibraryDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions16clearLibraryDirsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearLibraryDirs(__IntPtr __instance); @@ -41135,7 +41135,7 @@ public partial struct __Internal internal static extern __IntPtr GetLibraries(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions12addLibrariesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddLibraries(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddLibraries(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions14clearLibrariesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearLibraries(__IntPtr __instance); diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std.cs index 640bb868cd..0ce443cab4 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/Std.cs @@ -492,7 +492,7 @@ public unsafe static partial class BasicStringExtensions public partial struct __Internal { [SuppressUnmanagedCodeSecurity, DllImport("Std-symbols", EntryPoint = "_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern __IntPtr Assign(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string __s); + internal static extern __IntPtr Assign(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string __s); [SuppressUnmanagedCodeSecurity, DllImport("Std-symbols", EntryPoint = "_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4dataEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern __IntPtr Data(__IntPtr __instance); diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs index f9e3781732..01f2105959 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs @@ -83,7 +83,7 @@ public partial struct __Internal internal static extern __IntPtr GetSymbols(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary10addSymbolsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSymbols(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSymbols(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary12clearSymbolsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSymbols(__IntPtr __instance); @@ -92,7 +92,7 @@ public partial struct __Internal internal static extern __IntPtr GetDependencies(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary15addDependenciesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddDependencies(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddDependencies(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser3AST13NativeLibrary17clearDependenciesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearDependencies(__IntPtr __instance); @@ -40501,7 +40501,7 @@ public partial struct __Internal internal static extern __IntPtr GetArguments(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions12addArgumentsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14clearArgumentsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearArguments(__IntPtr __instance); @@ -40510,7 +40510,7 @@ public partial struct __Internal internal static extern __IntPtr GetCompilationOptions(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions21addCompilationOptionsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddCompilationOptions(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddCompilationOptions(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions23clearCompilationOptionsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearCompilationOptions(__IntPtr __instance); @@ -40519,7 +40519,7 @@ public partial struct __Internal internal static extern __IntPtr GetSourceFiles(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14addSourceFilesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSourceFiles(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSourceFiles(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions16clearSourceFilesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSourceFiles(__IntPtr __instance); @@ -40528,7 +40528,7 @@ public partial struct __Internal internal static extern __IntPtr GetIncludeDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14addIncludeDirsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions16clearIncludeDirsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearIncludeDirs(__IntPtr __instance); @@ -40537,7 +40537,7 @@ public partial struct __Internal internal static extern __IntPtr GetSystemIncludeDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions20addSystemIncludeDirsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSystemIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSystemIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions22clearSystemIncludeDirsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSystemIncludeDirs(__IntPtr __instance); @@ -40546,7 +40546,7 @@ public partial struct __Internal internal static extern __IntPtr GetDefines(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions10addDefinesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddDefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddDefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions12clearDefinesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearDefines(__IntPtr __instance); @@ -40555,7 +40555,7 @@ public partial struct __Internal internal static extern __IntPtr GetUndefines(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions12addUndefinesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddUndefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddUndefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions14clearUndefinesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearUndefines(__IntPtr __instance); @@ -40564,7 +40564,7 @@ public partial struct __Internal internal static extern __IntPtr GetSupportedStdTypes(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions20addSupportedStdTypesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSupportedStdTypes(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSupportedStdTypes(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions22clearSupportedStdTypesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSupportedStdTypes(__IntPtr __instance); @@ -40573,7 +40573,7 @@ public partial struct __Internal internal static extern __IntPtr GetSupportedFunctionTemplates(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions29addSupportedFunctionTemplatesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSupportedFunctionTemplates(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSupportedFunctionTemplates(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppParserOptions31clearSupportedFunctionTemplatesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSupportedFunctionTemplates(__IntPtr __instance); @@ -41117,7 +41117,7 @@ public partial struct __Internal internal static extern __IntPtr GetArguments(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions12addArgumentsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions14clearArgumentsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearArguments(__IntPtr __instance); @@ -41126,7 +41126,7 @@ public partial struct __Internal internal static extern __IntPtr GetLibraryDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions14addLibraryDirsEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddLibraryDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddLibraryDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions16clearLibraryDirsEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearLibraryDirs(__IntPtr __instance); @@ -41135,7 +41135,7 @@ public partial struct __Internal internal static extern __IntPtr GetLibraries(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions12addLibrariesEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddLibraries(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddLibraries(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser", EntryPoint = "_ZN8CppSharp9CppParser16CppLinkerOptions14clearLibrariesEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearLibraries(__IntPtr __instance); diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std.cs index 55496aa49f..36cf8b697c 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/Std.cs @@ -468,7 +468,7 @@ public unsafe static partial class BasicStringExtensions public partial struct __Internal { [SuppressUnmanagedCodeSecurity, DllImport("Std-symbols", EntryPoint = "_ZNSs6assignEPKc", CallingConvention = __CallingConvention.Cdecl)] - internal static extern __IntPtr Assign(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string __s); + internal static extern __IntPtr Assign(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string __s); [SuppressUnmanagedCodeSecurity, DllImport("Std-symbols", EntryPoint = "_ZNKSs4dataEv", CallingConvention = __CallingConvention.Cdecl)] internal static extern __IntPtr Data(__IntPtr __instance); diff --git a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs index fde849036a..1584b5d28e 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs @@ -83,7 +83,7 @@ public partial struct __Internal internal static extern __IntPtr GetSymbols(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addSymbols@NativeLibrary@AST@CppParser@CppSharp@@QEAAXPEBD@Z", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSymbols(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSymbols(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearSymbols@NativeLibrary@AST@CppParser@CppSharp@@QEAAXXZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSymbols(__IntPtr __instance); @@ -92,7 +92,7 @@ public partial struct __Internal internal static extern __IntPtr GetDependencies(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addDependencies@NativeLibrary@AST@CppParser@CppSharp@@QEAAXPEBD@Z", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddDependencies(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddDependencies(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearDependencies@NativeLibrary@AST@CppParser@CppSharp@@QEAAXXZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearDependencies(__IntPtr __instance); @@ -40558,7 +40558,7 @@ public partial struct __Internal internal static extern __IntPtr GetArguments(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addArguments@CppParserOptions@CppParser@CppSharp@@QEAAXPEBD@Z", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearArguments@CppParserOptions@CppParser@CppSharp@@QEAAXXZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearArguments(__IntPtr __instance); @@ -40567,7 +40567,7 @@ public partial struct __Internal internal static extern __IntPtr GetCompilationOptions(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addCompilationOptions@CppParserOptions@CppParser@CppSharp@@QEAAXPEBD@Z", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddCompilationOptions(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddCompilationOptions(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearCompilationOptions@CppParserOptions@CppParser@CppSharp@@QEAAXXZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearCompilationOptions(__IntPtr __instance); @@ -40576,7 +40576,7 @@ public partial struct __Internal internal static extern __IntPtr GetSourceFiles(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addSourceFiles@CppParserOptions@CppParser@CppSharp@@QEAAXPEBD@Z", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSourceFiles(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSourceFiles(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearSourceFiles@CppParserOptions@CppParser@CppSharp@@QEAAXXZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSourceFiles(__IntPtr __instance); @@ -40585,7 +40585,7 @@ public partial struct __Internal internal static extern __IntPtr GetIncludeDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addIncludeDirs@CppParserOptions@CppParser@CppSharp@@QEAAXPEBD@Z", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearIncludeDirs@CppParserOptions@CppParser@CppSharp@@QEAAXXZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearIncludeDirs(__IntPtr __instance); @@ -40594,7 +40594,7 @@ public partial struct __Internal internal static extern __IntPtr GetSystemIncludeDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addSystemIncludeDirs@CppParserOptions@CppParser@CppSharp@@QEAAXPEBD@Z", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSystemIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSystemIncludeDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearSystemIncludeDirs@CppParserOptions@CppParser@CppSharp@@QEAAXXZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSystemIncludeDirs(__IntPtr __instance); @@ -40603,7 +40603,7 @@ public partial struct __Internal internal static extern __IntPtr GetDefines(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addDefines@CppParserOptions@CppParser@CppSharp@@QEAAXPEBD@Z", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddDefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddDefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearDefines@CppParserOptions@CppParser@CppSharp@@QEAAXXZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearDefines(__IntPtr __instance); @@ -40612,7 +40612,7 @@ public partial struct __Internal internal static extern __IntPtr GetUndefines(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addUndefines@CppParserOptions@CppParser@CppSharp@@QEAAXPEBD@Z", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddUndefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddUndefines(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearUndefines@CppParserOptions@CppParser@CppSharp@@QEAAXXZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearUndefines(__IntPtr __instance); @@ -40621,7 +40621,7 @@ public partial struct __Internal internal static extern __IntPtr GetSupportedStdTypes(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addSupportedStdTypes@CppParserOptions@CppParser@CppSharp@@QEAAXPEBD@Z", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSupportedStdTypes(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSupportedStdTypes(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearSupportedStdTypes@CppParserOptions@CppParser@CppSharp@@QEAAXXZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSupportedStdTypes(__IntPtr __instance); @@ -40630,7 +40630,7 @@ public partial struct __Internal internal static extern __IntPtr GetSupportedFunctionTemplates(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addSupportedFunctionTemplates@CppParserOptions@CppParser@CppSharp@@QEAAXPEBD@Z", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddSupportedFunctionTemplates(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddSupportedFunctionTemplates(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearSupportedFunctionTemplates@CppParserOptions@CppParser@CppSharp@@QEAAXXZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearSupportedFunctionTemplates(__IntPtr __instance); @@ -41174,7 +41174,7 @@ public partial struct __Internal internal static extern __IntPtr GetArguments(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addArguments@CppLinkerOptions@CppParser@CppSharp@@QEAAXPEBD@Z", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddArguments(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearArguments@CppLinkerOptions@CppParser@CppSharp@@QEAAXXZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearArguments(__IntPtr __instance); @@ -41183,7 +41183,7 @@ public partial struct __Internal internal static extern __IntPtr GetLibraryDirs(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addLibraryDirs@CppLinkerOptions@CppParser@CppSharp@@QEAAXPEBD@Z", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddLibraryDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddLibraryDirs(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearLibraryDirs@CppLinkerOptions@CppParser@CppSharp@@QEAAXXZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearLibraryDirs(__IntPtr __instance); @@ -41192,7 +41192,7 @@ public partial struct __Internal internal static extern __IntPtr GetLibraries(__IntPtr __instance, uint i); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?addLibraries@CppLinkerOptions@CppParser@CppSharp@@QEAAXPEBD@Z", CallingConvention = __CallingConvention.Cdecl)] - internal static extern void AddLibraries(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string s); + internal static extern void AddLibraries(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string s); [SuppressUnmanagedCodeSecurity, DllImport("CppSharp.CppParser.dll", EntryPoint = "?clearLibraries@CppLinkerOptions@CppParser@CppSharp@@QEAAXXZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern void ClearLibraries(__IntPtr __instance); diff --git a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/Std.cs b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/Std.cs index a34a2d26e6..48d6e9c998 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/Std.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/Std.cs @@ -463,7 +463,7 @@ public unsafe static partial class BasicStringExtensions public partial struct __Internal { [SuppressUnmanagedCodeSecurity, DllImport("Std-symbols", EntryPoint = "?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@QEBD@Z", CallingConvention = __CallingConvention.Cdecl)] - internal static extern __IntPtr Assign(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string _Ptr); + internal static extern __IntPtr Assign(__IntPtr __instance, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8StringMarshaller))] string _Ptr); [SuppressUnmanagedCodeSecurity, DllImport("Std-symbols", EntryPoint = "?data@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEBDXZ", CallingConvention = __CallingConvention.Cdecl)] internal static extern __IntPtr Data(__IntPtr __instance); diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index da08cc4924..a3afffddcc 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -3566,7 +3566,7 @@ public void GenerateInternalFunction(Function function) if (Options.UseDllImport) { - callConv = $", CallingConvention = CallingConvention.{function.CallingConvention.ToInteropCallConv()}"; + callConv = $", CallingConvention = __CallingConvention.{function.CallingConvention.ToInteropCallConv()}"; libImportType = "DllImport"; functionKeyword = "extern"; } @@ -3635,27 +3635,35 @@ private string GetImportAttributeString(string libImportType, string callConv, F if (!Options.UseDllImport) { - HashSet marshallers = new(2); + HashSet addedMarshallers = new(3); - foreach (var param in function.Parameters.Where(param => param.Type.IsConstCharString())) + + foreach (var param in function.Parameters) { try { - - var encoding = new ConstCharPointer() { Type = param.QualifiedType.Type, Context = Context } - .GetEncoding().Encoding; - - if (encoding == Encoding.UTF8 && marshallers.Add("UTF8")) - sb.Append(", StringMarshalling = StringMarshalling.Utf8"); - else if (encoding == Encoding.UTF32 && marshallers.Add("UTF32")) - sb.Append(", StringMarshallingCustomType = typeof(CppSharp.Runtime.UTF32Marshaller)"); - - + if (param.Type.IsConstCharString()) + { + var encoding = new ConstCharPointer() { Type = param.Type, Context = Context } + .GetEncoding().Encoding; + + if (encoding == Encoding.UTF8 && addedMarshallers.Add("UTF8")) + sb.Append(", StringMarshalling = StringMarshalling.Utf8"); + else if (encoding == Encoding.UTF32 && addedMarshallers.Add("UTF32")) + sb.Append(", StringMarshallingCustomType = typeof(CppSharp.Runtime.UTF32StringMarshaller)"); + else if (encoding == Encoding.Unicode && addedMarshallers.Add("UTF16")) + sb.Append(", StringMarshalling = StringMarshalling.Utf16"); + } + else if ((param.Type.IsPrimitiveType(PrimitiveType.String) || + param.Type.IsPrimitiveType(PrimitiveType.Char16) || + param.Type.IsPrimitiveType(PrimitiveType.WideChar)) && + addedMarshallers.Add("UTF16")) + sb.Append(", StringMarshalling = StringMarshalling.Utf16"); } catch (Exception e) { Console.WriteLine($"Error processing parameter '{param.Name}': {e.Message}"); - Console.WriteLine($"Param Type: {param.Type?.ToString() ?? "null"}, Param Name: {param.Name ?? "null"}"); + Console.WriteLine($"Param Type: {param.Type ?? null}, Param Name: {param.Name ?? "null"}"); } } } diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index 6626da9fd0..ee8452f462 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -538,16 +538,27 @@ public TypePrinterResult VisitTemplateArgument(TemplateArgument a) public override TypePrinterResult VisitParameterDecl(Parameter parameter) { - var paramType = parameter.Type; - if (parameter.Kind == ParameterKind.IndirectReturnType) return IntPtrType; + var typeBuilder = new StringBuilder(); + var paramType = parameter.Type; + if (!Options.UseDllImport) + { + if (paramType.IsPrimitiveType(PrimitiveType.Bool)) + typeBuilder.Append("[MarshalAs(UnmanagedType.I1)] "); + else if ((ContextKind != TypePrinterContextKind.Native || Context.Options.MarshalCharAsManagedChar) && (paramType.IsPrimitiveType(PrimitiveType.Char) || paramType.IsPrimitiveType(PrimitiveType.Char32))) + typeBuilder.AppendFormat("[MarshalUsing(typeof(CppSharp.Runtime.{0}))]", paramType.IsPrimitiveType(PrimitiveType.Char) ? "UTF8CharMarshaller" : "UTF32CharMarshaller"); + } + Parameter = parameter; + var ret = paramType.Visit(this); + typeBuilder.Append(ret); + Parameter = null; - return ret; + return typeBuilder.ToString(); } private string GetName(Declaration decl) @@ -604,13 +615,9 @@ public override TypePrinterResult VisitParameters(IEnumerable @params public override TypePrinterResult VisitParameter(Parameter param, bool hasName) { var typeBuilder = new StringBuilder(); - if (param.Type.Desugar().IsPrimitiveType(PrimitiveType.Bool) - && (!Options.UseDllImport || MarshalKind == MarshalKind.GenericDelegate)) - {// LibraryImport requires specific marshalling for bool + if (param.Type.Desugar().IsPrimitiveType(PrimitiveType.Bool) && MarshalKind == MarshalKind.GenericDelegate) typeBuilder.Append("[MarshalAs(UnmanagedType.I1)] "); - Console.WriteLine($"IsLibraryImport:{!Options.UseDllImport}"); - ((List)Options.Modules).GetEnumerator().((module)=>Console.WriteLine($"Current Bindings being generated: {module.LibraryName}")); - } + var printedType = param.Type.Visit(this, param.QualifiedType.Qualifiers); typeBuilder.Append(printedType); var type = typeBuilder.ToString(); diff --git a/src/Generator/Options.cs b/src/Generator/Options.cs index 3a874d7fb8..5acdb863b2 100644 --- a/src/Generator/Options.cs +++ b/src/Generator/Options.cs @@ -106,11 +106,11 @@ public bool DoAllModulesHaveLibraries() => /// /// C# only: Specifies the type of interop attribute to be used in the generated bindings. - /// Default value is dependent on target framework version + /// Default value is dependent on targetframework version of the application using Cppsharp /// public LibraryImportType LibraryImportType { get; set; } = GetLibraryImportType(); - + public bool UseDllImport => LibraryImportType == LibraryImportType.DllImport; public bool OutputInteropIncludes; @@ -290,20 +290,25 @@ public bool GenerateSingleCSharpFile public TranslationUnitPassCallBack TranslationUnitPassPostCallBack { get; set; } - internal static LibraryImportType GetLibraryImportType() + internal static LibraryImportType GetLibraryImportType() { + + var targetFramework = Assembly.GetCallingAssembly() + .GetCustomAttribute(); + + ArgumentNullException.ThrowIfNull(targetFramework); + + var frameworkName = targetFramework.FrameworkName; + var versionString = frameworkName.Split(',').FirstOrDefault(s => s.Contains("Version"))?.Split('=')[1]; - var targetFrameworkInfo = Assembly.GetCallingAssembly() - .GetCustomAttribute() - .FrameworkName.Split(","); - - if (float.TryParse(targetFrameworkInfo[1].Split("Version=")[1].Trim('v'), out var targetFrameworkVer)){ - if (targetFrameworkVer >= 7.0) - { - return LibraryImportType.LibraryImport; - } - } - return LibraryImportType.DllImport; + if (versionString != null && float.TryParse(versionString, out var targetFrameworkVer)) + { + if (targetFrameworkVer >= 7.0) + { + return LibraryImportType.LibraryImport; + } + } + return LibraryImportType.DllImport; } #endregion @@ -314,7 +319,7 @@ public class InvalidOptionException : Exception public InvalidOptionException(string message) : base(message) { - + } } } diff --git a/src/Generator/Types/Std/Stdlib.CSharp.cs b/src/Generator/Types/Std/Stdlib.CSharp.cs index d932fc2e97..871a67c9ed 100644 --- a/src/Generator/Types/Std/Stdlib.CSharp.cs +++ b/src/Generator/Types/Std/Stdlib.CSharp.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Globalization; -using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; @@ -108,7 +106,7 @@ public override Type SignatureType(TypePrinterContext ctx) // Perhaps we need a CppSharp.Runtime.ASCIIMarshaller? return new CustomType("[MarshalAs(UnmanagedType.LPStr)] string"); else if (encoding == Encoding.UTF8 || encoding == Encoding.UTF32) - return new CustomType($"{(Context.Options.UseDllImport ? $"[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof({(encoding == Encoding.UTF32 ? "CppSharp.Runtime.UTF32Marshaller" : "CppSharp.Runtime.UTF8Marshaller")}))] " : string.Empty)}string"); + return new CustomType($"{(Context.Options.UseDllImport ? $"[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof({(encoding == Encoding.UTF32 ? "CppSharp.Runtime.UTF32StringMarshaller" : "CppSharp.Runtime.UTF8StringMarshaller")}))] " : string.Empty)}string"); else if (encoding == Encoding.Unicode || encoding == Encoding.BigEndianUnicode) return new CustomType("[MarshalAs(UnmanagedType.LPWStr)] string"); diff --git a/src/Runtime/CppSharp.Runtime.csproj b/src/Runtime/CppSharp.Runtime.csproj index 6b2ee95522..baf46b4f66 100644 --- a/src/Runtime/CppSharp.Runtime.csproj +++ b/src/Runtime/CppSharp.Runtime.csproj @@ -1,6 +1,6 @@  - 7.3 + 8.0 true netstandard2.0 AnyCPU diff --git a/src/Runtime/UTF32Marshaller.cs b/src/Runtime/UTF32Marshaller.cs index 03f2d637fa..b5b90cfb25 100644 --- a/src/Runtime/UTF32Marshaller.cs +++ b/src/Runtime/UTF32Marshaller.cs @@ -4,52 +4,95 @@ namespace CppSharp.Runtime { - public class UTF32Marshaller : ICustomMarshaler + public class UTF32StringMarshaller : ICustomMarshaler { - static private UTF32Marshaller marshaler; + private static ICustomMarshaler _instance; public unsafe object MarshalNativeToManaged(IntPtr pNativeData) { - var p = (Int32*)pNativeData; + if (pNativeData == IntPtr.Zero) + return string.Empty; + + var p = (int*)pNativeData; int count = 0; while (*p++ != 0) ++count; return Encoding.UTF32.GetString((byte*)pNativeData, count * 4); } - public unsafe IntPtr MarshalManagedToNative(object ManagedObj) + public unsafe IntPtr MarshalManagedToNative(object managedObj) { - if (!(ManagedObj is string @string)) + if (managedObj == null) return IntPtr.Zero; - var capacity = @string.Length * 4 + 4; - var result = Marshal.AllocCoTaskMem(capacity); - var byteCount = 0; - fixed (char* stringPtr = @string) - byteCount = Encoding.UTF32.GetBytes(stringPtr, @string.Length, (byte*)result, capacity); - *(Int32*)(result + byteCount) = 0; + if (!(managedObj is string str)) + throw new MarshalDirectiveException("UTF32StringMarshaller must be used on string"); + + int capacity = (str.Length * 4) + 4; + IntPtr result = Marshal.AllocCoTaskMem(capacity); + + fixed (char* stringPtr = str) + { + int byteCount = Encoding.UTF32.GetBytes(stringPtr, str.Length, (byte*)result, capacity); + Marshal.WriteInt32(result + byteCount, 0); + } + return result; } - public void CleanUpNativeData(IntPtr pNativeData) + public void CleanUpNativeData(IntPtr pNativeData){ + if (pNativeData != IntPtr.Zero) + Marshal.FreeCoTaskMem(pNativeData); + } + + + public void CleanUpManagedData(object managedObj) { - Marshal.FreeCoTaskMem(pNativeData); } + public int GetNativeDataSize() => -1; + + + public static ICustomMarshaler GetInstance(string pstrCookie) => _instance ??= new UTF32StringMarshaller(); + } + + public class UTF32CharMarshaller : ICustomMarshaler + { + private static ICustomMarshaler _instance; + public void CleanUpManagedData(object ManagedObj) { } - public int GetNativeDataSize() + public void CleanUpNativeData(IntPtr pNativeData) { - return -1; + if (pNativeData != IntPtr.Zero) + Marshal.FreeCoTaskMem(pNativeData); } - public static ICustomMarshaler GetInstance(string pstrCookie) + public int GetNativeDataSize() => 8; + + public IntPtr MarshalManagedToNative(object managedObj) { - if (marshaler == null) - marshaler = new UTF32Marshaller(); - return marshaler; + if (!(managedObj is char c)) + throw new MarshalDirectiveException("UTF32CharMarshaller must be used on a char"); + + IntPtr pNativeData = Marshal.AllocCoTaskMem(8); + int utf32Char = char.ConvertToUtf32(c.ToString(), 0); + Marshal.WriteInt32(pNativeData, utf32Char); + Marshal.WriteInt32(pNativeData + 4, 0); // Null terminator + return pNativeData; } + + public object MarshalNativeToManaged(IntPtr pNativeData) + { + if (pNativeData == IntPtr.Zero) + return '\0'; + + int utf32Char = Marshal.ReadInt32(pNativeData); + return utf32Char == 0 ? '\0' : char.ConvertFromUtf32(utf32Char)[0]; + } + + public static ICustomMarshaler GetInstance(string pstrCookie) => _instance ??= new UTF32CharMarshaller(); } -} +} \ No newline at end of file diff --git a/src/Runtime/UTF8Marshaller.cs b/src/Runtime/UTF8Marshaller.cs index cc9fa50c7b..244e9c08e9 100644 --- a/src/Runtime/UTF8Marshaller.cs +++ b/src/Runtime/UTF8Marshaller.cs @@ -4,15 +4,21 @@ namespace CppSharp.Runtime { + // HACK: .NET Standard 2.0 which we use in auto-building to support .NET Framework, lacks UnmanagedType.LPUTF8Str - public class UTF8Marshaller : ICustomMarshaler + public class UTF8StringMarshaller : ICustomMarshaler { + + private static ICustomMarshaler _instance; public void CleanUpManagedData(object ManagedObj) { } public void CleanUpNativeData(IntPtr pNativeData) - => Marshal.FreeHGlobal(pNativeData); + { + if (pNativeData != IntPtr.Zero) + Marshal.FreeHGlobal(pNativeData); + } public int GetNativeDataSize() => -1; @@ -20,17 +26,14 @@ public IntPtr MarshalManagedToNative(object managedObj) { if (managedObj == null) return IntPtr.Zero; + if (!(managedObj is string)) - throw new MarshalDirectiveException( - "UTF8Marshaler must be used on a string."); + throw new MarshalDirectiveException("UTF8StringMarshaler must be used on a string"); - // not null terminated byte[] strbuf = Encoding.UTF8.GetBytes((string)managedObj); IntPtr buffer = Marshal.AllocHGlobal(strbuf.Length + 1); Marshal.Copy(strbuf, 0, buffer, strbuf.Length); - - // write the terminating null - Marshal.WriteByte(buffer + strbuf.Length, 0); + Marshal.WriteByte(buffer + strbuf.Length, 0); // Null terminator return buffer; } @@ -46,13 +49,55 @@ public unsafe object MarshalNativeToManaged(IntPtr str) return Encoding.UTF8.GetString((byte*)str, byteCount); } - public static ICustomMarshaler GetInstance(string pstrCookie) + public static ICustomMarshaler GetInstance(string pstrCookie) => _instance ??= new UTF8StringMarshaller(); + } + + public class UTF8CharMarshaller : ICustomMarshaler + { + private static ICustomMarshaler _instance; + + public void CleanUpManagedData(object managedObj) + { + } + + public void CleanUpNativeData(IntPtr pNativeData){ + if (pNativeData != IntPtr.Zero) + Marshal.FreeHGlobal(pNativeData); + } + + public int GetNativeDataSize() => -1; + + public IntPtr MarshalManagedToNative(object managedObj) + { + if (!(managedObj is char c)) + throw new MarshalDirectiveException("UTF8CharMarshaller must be used on a char"); + + byte[] charbuf = Encoding.UTF8.GetBytes(new[] { c }); + IntPtr buffer = Marshal.AllocHGlobal(charbuf.Length + 1); + Marshal.Copy(charbuf, 0, buffer, charbuf.Length); + Marshal.WriteByte(buffer + charbuf.Length, 0); // Null terminator + return buffer; + } + + public object MarshalNativeToManaged(IntPtr pNativeData) { - if (marshaler == null) - marshaler = new UTF8Marshaller(); - return marshaler; + byte[] charBytes = new byte[4]; + int byteCount = 0; + + while (byteCount < charBytes.Length && Marshal.ReadByte(pNativeData + byteCount) != 0) + { + charBytes[byteCount] = Marshal.ReadByte(pNativeData + byteCount); + byteCount++; + } + + string decodedChar = Encoding.UTF8.GetString(charBytes, 0, byteCount); + if (decodedChar.Length != 1) + throw new InvalidOperationException("The UTF-8 byte sequence does not represent a single char."); + + return decodedChar[0]; } - private static UTF8Marshaller marshaler; + public static ICustomMarshaler GetInstance(string pstrCookie) => _instance ??= new UTF8CharMarshaller(); } } +