+
+ [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;
+ }
+
+ [DllImport ("libtest", EntryPoint="mono_test_has_thiscall")]
+ public static extern int mono_test_has_thiscall ();
+
+ [DllImport ("libtest", EntryPoint = "_mono_test_native_thiscall1", CallingConvention=CallingConvention.ThisCall)]
+ public static extern int mono_test_native_thiscall (int a);
+
+ [DllImport ("libtest", EntryPoint = "_mono_test_native_thiscall2", CallingConvention=CallingConvention.ThisCall)]
+ public static extern int mono_test_native_thiscall (int a, int b);
+
+ [DllImport ("libtest", EntryPoint = "_mono_test_native_thiscall3", CallingConvention=CallingConvention.ThisCall)]
+ public static extern int mono_test_native_thiscall (int a, int b, int c);
+
+ [DllImport ("libtest", EntryPoint = "_mono_test_native_thiscall1", CallingConvention=CallingConvention.ThisCall)]
+ public static extern int mono_test_native_thiscall (TinyStruct a);
+
+ [DllImport ("libtest", EntryPoint = "_mono_test_native_thiscall2", CallingConvention=CallingConvention.ThisCall)]
+ public static extern int mono_test_native_thiscall (TinyStruct a, int b);
+
+ [DllImport ("libtest", EntryPoint = "_mono_test_native_thiscall3", CallingConvention=CallingConvention.ThisCall)]
+ public static extern int mono_test_native_thiscall (TinyStruct a, int b, int c);
+
+ public static int test_0_native_thiscall ()
+ {
+ if (mono_test_has_thiscall () == 0)
+ return 0;
+
+ if (mono_test_native_thiscall (1968329802) != 1968329802)
+ return 1;
+
+ if (mono_test_native_thiscall (268894549, 1212675791) != 1481570339)
+ return 2;
+
+ if (mono_test_native_thiscall (1288082683, -421187449, -1733670329) != -866775098)
+ return 3;
+
+ if (mono_test_native_thiscall (new TinyStruct(1968329802)) != 1968329802)
+ return 4;
+
+ if (mono_test_native_thiscall (new TinyStruct(268894549), 1212675791) != 1481570339)
+ return 5;
+
+ if (mono_test_native_thiscall (new TinyStruct(1288082683), -421187449, -1733670329) != -866775098)
+ return 6;
+
+ return 0;
+ }
+
+ [DllImport ("libtest", EntryPoint = "mono_test_marshal_return_single_double_struct")]
+ public static extern SingleDoubleStruct mono_test_marshal_return_single_double_struct ();
+
+ public static int test_0_x86_single_double_struct_ret () {
+ double d = mono_test_marshal_return_single_double_struct ().d;
+ if (d != 3.0)
+ return 1;
+ else
+ return 0;
+ }