Skip to content

Commit b2c1c01

Browse files
committed
Adjustments for std:wstring support for CLI
- Adjusted TypeMap for wstring in Stdlib.CLI.cs - Fixed typo in Common.Test.cs - Added check in test - Added wstring exports in Std-symbols.cpp
1 parent d726c14 commit b2c1c01

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/Std-symbols.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ template __declspec(dllexport) std::basic_string<char, std::char_traits<char>, s
99
template __declspec(dllexport) std::basic_string<char, std::char_traits<char>, std::allocator<char>>::~basic_string() noexcept;
1010
template __declspec(dllexport) std::basic_string<char, std::char_traits<char>, std::allocator<char>>& std::basic_string<char, std::char_traits<char>, std::allocator<char>>::assign(const char* const);
1111
template __declspec(dllexport) const char* std::basic_string<char, std::char_traits<char>, std::allocator<char>>::data() const noexcept;
12+
13+
template __declspec(dllexport) std::allocator<wchar_t>::allocator() noexcept;
14+
template __declspec(dllexport) std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>>::basic_string() noexcept(true);
15+
template __declspec(dllexport) std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>>::~basic_string() noexcept;
16+
template __declspec(dllexport) std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>>& std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>>::assign(const wchar_t* const);
17+
template __declspec(dllexport) const wchar_t* std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>>::data() const noexcept;

src/Generator/Types/Std/Stdlib.CLI.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public override void CLIMarshalToManaged(MarshalContext ctx)
103103
}
104104
}
105105

106-
[TypeMap("std::wstring", GeneratorKind = GeneratorKind.CLI)]
106+
[TypeMap("basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t>>", GeneratorKind = GeneratorKind.CLI)]
107107
public partial class WString : TypeMap
108108
{
109109
public override Type CLISignatureType(TypePrinterContext ctx)

tests/Common/Common.Tests.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1020,15 +1020,16 @@ This is a very long string. This is a very long string. This is a very long stri
10201020

10211021
using (var hasStdWString = new HasStdWString())
10221022
{
1023+
Assert.That(hasStdWString.TestStdWStringPassedByValue(t), Is.EqualTo(t + "_test"));
10231024
Assert.That(hasStdWString.TestStdWString(t), Is.EqualTo(t + "_test"));
10241025
hasStdWString.S = t;
10251026
Assert.That(hasStdWString.S, Is.EqualTo(t));
10261027
Assert.That(hasStdWString.StdWString, Is.EqualTo(t));
1027-
Assert.That(hasStdWString.StdWString, Is.EqualTo(t)
1028+
Assert.That(hasStdWString.StdWString, Is.EqualTo(t));
10281029
Assert.That(hasStdWString.TestStdWString(unicodeString1), Is.EqualTo(unicodeString1 + "_test"));
10291030
hasStdWString.S = unicodeString1;
10301031
Assert.That(hasStdWString.S, Is.EqualTo(unicodeString1));
1031-
Assert.That(hasStdWString.StdWString, Is.EqualTo(unicodeString1)
1032+
Assert.That(hasStdWString.StdWString, Is.EqualTo(unicodeString1));
10321033
Assert.That(hasStdWString.TestStdWString(unicodeString2), Is.EqualTo(unicodeString2 + "_test"));
10331034
hasStdWString.S = unicodeString2;
10341035
Assert.That(hasStdWString.S, Is.EqualTo(unicodeString2));

0 commit comments

Comments
 (0)