return a;
}
+LIBTEST_API float STDCALL
+mono_test_marshal_pass_return_float (float f) {
+ return f + 1.0;
+}
+
struct ss
{
int i;
return delegate (2);
}
+static int STDCALL inc_cb (int i)
+{
+ return i + 1;
+}
+
+LIBTEST_API int STDCALL
+mono_test_marshal_out_delegate (SimpleDelegate *delegate)
+{
+ *delegate = inc_cb;
+
+ return 0;
+}
+
LIBTEST_API SimpleDelegate STDCALL
mono_test_marshal_return_delegate (SimpleDelegate delegate)
{
} test_struct5;
LIBTEST_API test_struct5 STDCALL
-mono_test_marshal_ia64_pass_return_struct5 (double d1, double d2, test_struct5 s, double d3, double d4)
+mono_test_marshal_ia64_pass_return_struct5 (double d1, double d2, test_struct5 s, int i, double d3, double d4)
{
- s.d1 += d1 + d2;
- s.d2 += d3 + d4;
+ s.d1 += d1 + d2 + i;
+ s.d2 += d3 + d4 + i;
return s;
}
return 0;
}
-typedef char** (*ReturnStringArrayDelegate) (int i);
+typedef char** (STDCALL *ReturnStringArrayDelegate) (int i);
LIBTEST_API int STDCALL
mono_test_marshal_return_string_array_delegate (ReturnStringArrayDelegate d)
return res;
}
+typedef int (STDCALL *ByrefStringDelegate) (char **s);
+
+LIBTEST_API int STDCALL
+mono_test_marshal_byref_string_delegate (ByrefStringDelegate d)
+{
+ char *s = (char*)"ABC";
+ int res;
+
+ res = d (&s);
+ if (res != 0)
+ return res;
+
+ if (!strcmp (s, "DEF"))
+ res = 0;
+ else
+ res = 2;
+
+ marshal_free (s);
+
+ return res;
+}
+
LIBTEST_API int STDCALL
add_delegate (int i, int j)
{
{
HandleRef ref;
+ memset (&ref, 0, sizeof (ref));
+
return ref;
}
* mono_method_get_unmanaged_thunk tests
*/
-#if defined(__GNUC__) && defined(__i386__) && (defined(__linux__) || defined (__APPLE__))
+#if defined(__GNUC__) && ((defined(__i386__) && (defined(__linux__) || defined (__APPLE__))) || (defined(__ppc__) && defined(__APPLE__)))
#define ALIGN(size) __attribute__ ((aligned(size)))
#else
#define ALIGN(size)
/* Searches for mono symbols in all loaded modules */
static gpointer
-lookup_mono_symbol (char *symbol_name)
+lookup_mono_symbol (const char *symbol_name)
{
gpointer symbol;
if (g_module_symbol (g_module_open (NULL, G_MODULE_BIND_LAZY), symbol_name, &symbol))
gpointer (*mono_method_get_unmanaged_thunk)(gpointer)
= lookup_mono_symbol ("mono_method_get_unmanaged_thunk");
- gpointer (*mono_string_new_wrapper)(char *)
+ gpointer (*mono_string_new_wrapper)(const char *)
= lookup_mono_symbol ("mono_string_new_wrapper");
char* (*mono_string_to_utf8)(gpointer)
typedef struct
{
winx64_struct1 a;
- short b;\r
+ short b;
char c;
} winx64_struct6;
}
LIBTEST_API winx64_struct1 STDCALL
-mono_test_Winx64_struct1_ret ()
+mono_test_Winx64_struct1_ret (void)
{
winx64_struct1 ret;
ret.a = 123;
}
LIBTEST_API winx64_struct2 STDCALL
-mono_test_Winx64_struct2_ret ()
+mono_test_Winx64_struct2_ret (void)
{
winx64_struct2 ret;
ret.a = 4;
}
LIBTEST_API winx64_struct3 STDCALL
-mono_test_Winx64_struct3_ret ()
+mono_test_Winx64_struct3_ret (void)
{
winx64_struct3 ret;
ret.a = 4;
}
LIBTEST_API winx64_struct4 STDCALL
-mono_test_Winx64_struct4_ret ()
+mono_test_Winx64_struct4_ret (void)
{
winx64_struct4 ret;
ret.a = 4;
}
LIBTEST_API winx64_struct5 STDCALL
-mono_test_Winx64_struct5_ret ()
+mono_test_Winx64_struct5_ret (void)
{
winx64_struct5 ret;
ret.a = 4;
return ret;
}
+LIBTEST_API winx64_struct1 STDCALL
+mono_test_Winx64_struct1_ret_5_args (char a, char b, char c, char d, char e)
+{
+ winx64_struct1 ret;
+ ret.a = a + b + c + d + e;
+ return ret;
+}
+
+LIBTEST_API winx64_struct5 STDCALL
+mono_test_Winx64_struct5_ret6_args (char a, char b, char c, char d, char e)
+{
+ winx64_struct5 ret;
+ ret.a = a + b;
+ ret.b = c + d;
+ ret.c = e;
+ return ret;
+}
+
typedef struct
{
float a;
return func (val);
}
+typedef int (STDCALL *managed_struct5_delegate) (winx64_struct5 a);
+
+LIBTEST_API int STDCALL
+mono_test_managed_Winx64_struct5_in(managed_struct5_delegate func)
+{
+ winx64_struct5 val;
+ val.a = 5;
+ val.b = 0x10;
+ val.c = 0x99;
+ return func (val);
+}
+
+typedef int (STDCALL *managed_struct1_struct5_delegate) (winx64_struct1 a, winx64_struct5 b,
+ winx64_struct1 c, winx64_struct5 d,
+ winx64_struct1 e, winx64_struct5 f);
+
+LIBTEST_API int STDCALL
+mono_test_managed_Winx64_struct1_struct5_in(managed_struct1_struct5_delegate func)
+{
+ winx64_struct1 a, c, e;
+ winx64_struct5 b, d, f;
+ a.a = 1;
+ b.a = 2; b.b = 3; b.c = 4;
+ c.a = 5;
+ d.a = 6; d.b = 7; d.c = 8;
+ e.a = 9;
+ f.a = 10; f.b = 11; f.c = 12;
+
+ return func (a, b, c, d, e, f);
+}
+
+typedef winx64_struct1 (STDCALL *managed_struct1_ret_delegate) (void);
+
+LIBTEST_API int STDCALL
+mono_test_Winx64_struct1_ret_managed (managed_struct1_ret_delegate func)
+{
+ winx64_struct1 ret;
+
+ ret = func ();
+
+ if (ret.a != 0x45)
+ return 1;
+
+ return 0;
+}
+
+typedef winx64_struct5 (STDCALL *managed_struct5_ret_delegate) (void);
+
+LIBTEST_API int STDCALL
+mono_test_Winx64_struct5_ret_managed (managed_struct5_ret_delegate func)
+{
+ winx64_struct5 ret;
+
+ ret = func ();
+
+ if (ret.a != 0x12)
+ return 1;
+ if (ret.b != 0x34)
+ return 2;
+ if (ret.c != 0x56)
+ return 3;
+
+ return 0;
+}
+
+
+