Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2004-07-02 18:44:05 +0400
committerMiguel de Icaza <miguel@gnome.org>2004-07-02 18:44:05 +0400
commitcd4389011e375ad4be2f63c2ff7ac22e8f0c1b12 (patch)
tree3e104459f21450cb0f65c147ffdec93a38f02711
parent3e11b388419380a83d4bec438d3a853854d06600 (diff)
Commit from head
svn path=/branches/mono-1-0/mono/; revision=30675
-rw-r--r--ChangeLog6
-rw-r--r--mono/metadata/marshal.c8
-rw-r--r--mono/tests/libtest.c11
-rwxr-xr-xmono/tests/pinvoke3.cs14
4 files changed, 39 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 38c10bb6577..1fb8a9d8faf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-07-03 Zoltan Varga <vargaz@freemail.hu>
+
+ * marshal.c (mono_marshal_get_managed_wrapper): Handle returning
+ delegates from a delegate. Fixes #61033.
+
+
2004-06-29 Jackson Harper <jackson@ximian.com>
* man/gacutil.1: Update man with new command line options.
diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c
index e2f384734b9..f15938d29c5 100644
--- a/mono/metadata/marshal.c
+++ b/mono/metadata/marshal.c
@@ -2576,6 +2576,14 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoObject *this, MonoMars
klass = sig->ret->data.klass;
+ if (klass->delegate) {
+ mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
+ mono_mb_emit_byte (mb, CEE_MONO_FUNC1);
+ mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_DEL_FTN);
+ mono_mb_emit_byte (mb, CEE_STLOC_3);
+ break;
+ }
+
/* FIXME: Raise a MarshalDirectiveException here */
g_assert ((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) != TYPE_ATTRIBUTE_AUTO_LAYOUT);
diff --git a/mono/tests/libtest.c b/mono/tests/libtest.c
index 0d651b00e80..1a2bcfb06e9 100644
--- a/mono/tests/libtest.c
+++ b/mono/tests/libtest.c
@@ -636,6 +636,17 @@ mono_test_marshal_primitive_byref_delegate (PrimitiveByrefDelegate delegate)
return 0;
}
+typedef int (*return_int_delegate) (int i);
+
+typedef return_int_delegate (*ReturnDelegateDelegate) ();
+
+int
+mono_test_marshal_return_delegate_delegate (ReturnDelegateDelegate d)
+{
+ return (d ()) (55);
+}
+
+
int
mono_test_marshal_stringbuilder (char *s, int n)
{
diff --git a/mono/tests/pinvoke3.cs b/mono/tests/pinvoke3.cs
index f463e14afc5..0a0d39ee3aa 100755
--- a/mono/tests/pinvoke3.cs
+++ b/mono/tests/pinvoke3.cs
@@ -150,6 +150,9 @@ public class Tests {
[DllImport ("libtest", EntryPoint="mono_test_marshal_primitive_byref_delegate")]
public static extern int mono_test_marshal_primitive_byref_delegate (PrimitiveByrefDelegate d);
+ [DllImport ("libtest", EntryPoint="mono_test_marshal_return_delegate_delegate")]
+ public static extern int mono_test_marshal_return_delegate_delegate (ReturnDelegateDelegate d);
+
public delegate int TestDelegate (int a, ref SimpleStruct ss, int b);
public delegate SimpleStruct SimpleDelegate2 (SimpleStruct ss);
@@ -168,6 +171,8 @@ public class Tests {
public delegate int PrimitiveByrefDelegate (ref int i);
+ public delegate return_int_delegate ReturnDelegateDelegate ();
+
public static int Main () {
return TestDriver.RunTests (typeof (Tests));
}
@@ -278,4 +283,13 @@ public class Tests {
return mono_test_marshal_primitive_byref_delegate (d);
}
+
+ public static return_int_delegate return_delegate () {
+ return new return_int_delegate (return_self);
+ }
+
+ static int test_55_marshal_return_delegate_delegate () {
+ return mono_test_marshal_return_delegate_delegate (new ReturnDelegateDelegate (return_delegate));
+ }
+
}