diff --git a/src/Generator/Passes/DelegatesPass.cs b/src/Generator/Passes/DelegatesPass.cs index 68d205fa..f647da57 100644 --- a/src/Generator/Passes/DelegatesPass.cs +++ b/src/Generator/Passes/DelegatesPass.cs @@ -276,7 +276,9 @@ namespace CppSharp.Passes // TODO: all of this needs proper general fixing by only leaving type names return types.Replace("global::System.", string.Empty) .Replace("[MarshalAs(UnmanagedType.LPUTF8Str)] ", string.Empty) - .Replace("[MarshalAs(UnmanagedType.LPWStr)] ", string.Empty) + .Replace("[MarshalAs(UnmanagedType.LPWStr)] string", "wstring") + .Replace("[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string", "string8") + .Replace("[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF32Marshaller))] string", "string32") .Replace("global::", string.Empty).Replace("*", "Ptr") .Replace('.', '_').Replace(' ', '_').Replace("::", "_") .Replace("[]", "Array"); diff --git a/src/Generator/Types/Std/Stdlib.CSharp.cs b/src/Generator/Types/Std/Stdlib.CSharp.cs index 42f0dc05..6edfc8fc 100644 --- a/src/Generator/Types/Std/Stdlib.CSharp.cs +++ b/src/Generator/Types/Std/Stdlib.CSharp.cs @@ -103,7 +103,7 @@ namespace CppSharp.Types.Std // This is not really right. ASCII is 7-bit only - the 8th bit is stripped; ANSI has // multi-byte support via a code page. MarshalAs(UnmanagedType.LPStr) marshals as ANSI. // Perhaps we need a CppSharp.Runtime.ASCIIMarshaller? - return new CustomType("[MarshalAs(UnmanagedType.LPStr)] string"); + return new CustomType("[MarshalAs(UnmanagedType.LPStr)] string"); else if (encoding == Encoding.UTF8) return new CustomType("[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string"); else if (encoding == Encoding.Unicode || encoding == Encoding.BigEndianUnicode) diff --git a/tests/CSharp/CSharp.cpp b/tests/CSharp/CSharp.cpp index c1f4dff0..62a15ce1 100644 --- a/tests/CSharp/CSharp.cpp +++ b/tests/CSharp/CSharp.cpp @@ -1489,6 +1489,7 @@ void TestChar32String::UpdateString(const char32_t* s) } const char32_t* TestChar32String::RetrieveString() { return thirtyTwoBitConst; } +void TestChar32String::functionPointerUTF32(void(*ptr)(const char32_t*)) {} TestChar16String::TestChar16String() : sixteenBitConst(u"ქართული ენა") diff --git a/tests/CSharp/CSharp.h b/tests/CSharp/CSharp.h index 1cf6642e..fd89203d 100644 --- a/tests/CSharp/CSharp.h +++ b/tests/CSharp/CSharp.h @@ -1165,6 +1165,7 @@ public: void UpdateString(const char32_t* s); const char32_t* RetrieveString(); + void functionPointerUTF32(void(*ptr)(const char32_t*)); }; class DLL_API TestChar16String