+2009-09-30 Zoltan Varga <vargaz@gmail.com>
+
+ * pinvoke2.cs libtest.c: Add a test for #543133.
+
2009-09-25 Mark Probst <mark.probst@gmail.com>
* xdomain-threads.c: Test for checking whether Thread is correctly
}
LIBTEST_API int STDCALL
-mono_cominterop_is_supported ()
+mono_cominterop_is_supported (void)
{
#if defined(TARGET_X86) || defined(TARGET_AMD64)
return 1;
return 0;
}
+LIBTEST_API void STDCALL
+mono_test_marshal_stringbuilder_out (char **s)
+{
+ const char m[] = "This is my message. Isn't it nice?";
+ char *str;
+
+ str = g_malloc (strlen (m) + 1);
+ memcpy (str, m, strlen (m) + 1);
+
+ *s = str;
+}
+
+LIBTEST_API int STDCALL
+mono_test_marshal_stringbuilder_out_unicode (gunichar2 **s)
+{
+ const char m[] = "This is my message. Isn't it nice?";
+ gunichar2 *s2;
+ glong len;
+
+ s2 = g_utf8_to_utf16 (m, -1, NULL, &len, NULL);
+
+ len = (len * 2) + 2;
+ *s = g_malloc (len);
+ memcpy (*s, s2, len);
+
+ g_free (s2);
+
+ return 0;
+}
+
typedef struct {
#ifndef __GNUC__
char a;
[DllImport ("libtest", EntryPoint="mono_test_marshal_stringbuilder_unicode", CharSet=CharSet.Unicode)]
public static extern void mono_test_marshal_stringbuilder_unicode (StringBuilder sb, int len);
+ [DllImport ("libtest", EntryPoint="mono_test_marshal_stringbuilder_out")]
+ public static extern void mono_test_marshal_stringbuilder_out (out StringBuilder sb);
+
+ [DllImport ("libtest", EntryPoint="mono_test_marshal_stringbuilder_out_unicode", CharSet=CharSet.Unicode)]
+ public static extern void mono_test_marshal_stringbuilder_out_unicode (out StringBuilder sb);
+
[DllImport ("libtest", EntryPoint="mono_test_last_error", SetLastError=true)]
public static extern void mono_test_last_error (int err);
return 0;
}
+ public static int test_0_marshal_stringbuilder_out () {
+ StringBuilder sb;
+ mono_test_marshal_stringbuilder_out (out sb);
+
+ if (sb.ToString () != "This is my message. Isn't it nice?")
+ return 1;
+ return 0;
+ }
+
+ public static int test_0_marshal_stringbuilder_out_unicode () {
+ StringBuilder sb;
+ mono_test_marshal_stringbuilder_out_unicode (out sb);
+
+ if (sb.ToString () != "This is my message. Isn't it nice?")
+ return 1;
+ return 0;
+ }
+
public static int test_0_marshal_empty_string_array () {
return mono_test_marshal_empty_string_array (null);
}