return callback ();
}
+LIBTEST_API int STDCALL
+mono_test_marshal_lpstr (char *str)
+{
+ return strcmp ("ABC", str);
+}
+
+LIBTEST_API int STDCALL
+mono_test_marshal_lpwstr (gunichar2 *str)
+{
+ char *s;
+ int res;
+
+ s = g_utf16_to_utf8 (str, -1, NULL, NULL, NULL);
+ res = strcmp ("ABC", s);
+ g_free (s);
+
+ return res;
+}
+
+LIBTEST_API char* STDCALL
+mono_test_marshal_return_lpstr (void)
+{
+ char *res = marshal_alloc (4);
+ strcpy (res, "XYZ");
+ return res;
+}
+
+
+LIBTEST_API gunichar2* STDCALL
+mono_test_marshal_return_lpwstr (void)
+{
+ gunichar2 *res = marshal_alloc (8);
+ gunichar2* tmp = g_utf8_to_utf16 ("XYZ", -1, NULL, NULL, NULL);
+
+ memcpy (res, tmp, 8);
+ g_free (tmp);
+
+ return res;
+}
else
return 2;
}
+
+ [DllImport ("libtest", EntryPoint="mono_test_marshal_lpstr")]
+ public static extern int mono_test_marshal_lpstr ([MarshalAs(UnmanagedType.LPStr)] string str);
+
+ public static int test_0_mono_test_marshal_lpstr () {
+ string str = "ABC";
+
+ if (mono_test_marshal_lpstr (str) != 0)
+ return 1;
+
+ return 0;
+ }
+
+ [DllImport ("libtest", EntryPoint="mono_test_marshal_lpwstr")]
+ public static extern int mono_test_marshal_lpwstr ([MarshalAs(UnmanagedType.LPWStr)] string str);
+
+ public static int test_0_mono_test_marshal_lpwstr () {
+ string str = "ABC";
+
+ if (mono_test_marshal_lpwstr (str) != 0)
+ return 1;
+
+ return 0;
+ }
+
+
+ [method: DllImport ("libtest", EntryPoint="mono_test_marshal_return_lpstr")]
+ [return: MarshalAs(UnmanagedType.LPStr)]
+ public static extern string mono_test_marshal_return_lpstr ();
+
+ public static int test_0_mono_test_marshal_return_lpstr () {
+ string str = mono_test_marshal_return_lpstr ();
+ if ("XYZ" == str)
+ return 0;
+
+ return 1;
+ }
+
+ [method: DllImport ("libtest", EntryPoint="mono_test_marshal_return_lpwstr")]
+ [return: MarshalAs(UnmanagedType.LPWStr)]
+ public static extern string mono_test_marshal_return_lpwstr ();
+
+ public static int test_0_mono_test_marshal_return_lpwstr () {
+ string str = mono_test_marshal_return_lpwstr ();
+ if ("XYZ" == str)
+ return 0;
+
+ return 1;
+ }
+
}