aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2019-07-24 21:51:52 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2019-07-25 18:57:10 +0100
commit15a0681b11977c965a720e3ae51ec26abdcc86a0 (patch)
tree38b39c371f330f2c2de978266dec2864d09dd8d9
parent0ff6893b2dc08b713db3ae71b125de15d629bb9a (diff)
downloadswig-15a0681b11977c965a720e3ae51ec26abdcc86a0.tar.gz
Add note about wchar_t marshalling fix required for Windows
-rw-r--r--Examples/test-suite/csharp/li_std_wstring_runme.cs5
-rw-r--r--Lib/csharp/wchar.i2
2 files changed, 5 insertions, 2 deletions
diff --git a/Examples/test-suite/csharp/li_std_wstring_runme.cs b/Examples/test-suite/csharp/li_std_wstring_runme.cs
index ab013f923..8b7ba1b30 100644
--- a/Examples/test-suite/csharp/li_std_wstring_runme.cs
+++ b/Examples/test-suite/csharp/li_std_wstring_runme.cs
@@ -99,7 +99,10 @@ public class runme
check_equal(received, expected);
}
- /* Not working on Windows okay on Linux
+ /* Not working for Japanese and Russian characters on Windows, okay on Linux
+ * Is fixed by adding CharSet=CharSet.Unicode to the DllImport, so change to:
+ * [global::System.Runtime.InteropServices.DllImport("li_std_wstring", CharSet=global::System.Runtime.InteropServices.CharSet.Unicode, EntryPoint="CSharp_li_std_wstringNamespace_test_wcvalue")]
+ * Needs a SWIG code change to support this
foreach (string test_string in test_strings)
{
foreach (char expected in test_string)
diff --git a/Lib/csharp/wchar.i b/Lib/csharp/wchar.i
index 79fb5a8cf..798194114 100644
--- a/Lib/csharp/wchar.i
+++ b/Lib/csharp/wchar.i
@@ -53,7 +53,7 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStri
// wchar_t
%typemap(ctype) wchar_t "wchar_t"
-%typemap(imtype) wchar_t "char"
+%typemap(imtype) wchar_t "char" // Requires adding CharSet=CharSet.Unicode to the DllImport to correctly marshal Unicode characters
%typemap(cstype) wchar_t "char"
%typemap(csin) wchar_t "$csinput"