return res;
}
+LIBTEST_API int STDCALL
+mono_invoke_simple_delegate (SimpleDelegate d)
+{
+ return d (4);
+}
+
LIBTEST_API int STDCALL
mono_test_marshal_char (short a1)
{
typedef struct {
int a;
- SimpleDelegate func, func2;
+ SimpleDelegate func, func2, func3;
} DelegateStruct;
LIBTEST_API DelegateStruct STDCALL
{
DelegateStruct res;
- res.a = ds.func (ds.a) + ds.func2 (ds.a);
+ res.a = ds.func (ds.a) + ds.func2 (ds.a) + (ds.func3 == NULL ? 0 : 1);
res.func = ds.func;
res.func2 = ds.func2;
+ res.func3 = NULL;
return res;
}
return res;
}
+typedef struct {
+ gint64 l;
+} LongStruct2;
+
+typedef struct {
+ int i;
+ LongStruct2 l;
+} LongStruct;
+
+LIBTEST_API int STDCALL
+mono_test_marshal_long_struct (LongStruct *s)
+{
+ return s->i + s->l.l;
+}
+
LIBTEST_API void STDCALL
mono_test_last_error (int err)
{
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)
{