[Mono-bugs] [Bug 70864][Maj] New - Mono don't generate native wrappers for delegates which returns structs or enums.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 29 Dec 2004 05:10:48 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by ddmk@r66.ru.

http://bugzilla.ximian.com/show_bug.cgi?id=70864

--- shadow/70864	2004-12-29 05:10:48.000000000 -0500
+++ shadow/70864.tmp.13902	2004-12-29 05:10:48.000000000 -0500
@@ -0,0 +1,112 @@
+Bug#: 70864
+Product: Mono: Runtime
+Version: 1.0
+OS: 
+OS Details: Windows 2003
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: JIT
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ddmk@r66.ru               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Mono don't generate native wrappers for delegates which returns structs or enums.
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+start of application failed with error 
+INVALID IL CODE AT IL001A in (wrapper native-to-managed) 
+testch.Class1:struct_test_body():IL001A:ret
+
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace testch
+{
+	class Class1
+	{
+	
+		public struct RET_STRUCT
+		{
+			public int abc;
+		}
+		public enum RET_ENUM
+		{
+			abc=1,
+		};
+
+		
+
+		public delegate RET_STRUCT struct_test();
+		public delegate RET_ENUM enum_test();
+		
+		static RET_STRUCT struct_test_body()
+		{
+			return new RET_STRUCT();
+		}
+		static RET_ENUM enum_test_body()
+		{
+			return new RET_ENUM();
+		}
+
+
+		[DllImport("c.dll")]
+			public static extern void  test(struct_test 
+a,enum_test b);
+
+		static void Main(string[] args)
+		{
+			test(new struct_test(struct_test_body),new 
+enum_test(enum_test_body));
+		}
+	}
+}
+
+//C++ to correct execution under microsoft .NET
+//c.dll
+#include "stdio.h"
+
+#define _DLL_EXPORT extern "C" __declspec( dllexport )
+struct RET_STRUCT
+{
+	int abc;
+};
+enum RET_ENUM
+{
+	abc=1,
+};
+
+
+typedef RET_STRUCT (__stdcall *call_back_type_struct)();
+typedef RET_ENUM (__stdcall *call_back_type_enum)();
+
+
+_DLL_EXPORT  void test(call_back_type_struct a, call_back_type_enum b)
+{
+a();
+b();
+}
+
+
+Actual Results:
+mono:
+INVALID IL CODE AT IL001A in (wrapper native-to-managed) 
+testch.Class1:struct_test_body():IL001A:ret
+
+mint is hangs up.
+
+Expected Results:
+<no output correct exit>
+
+
+How often does this happen? 
+everytime
+
+Additional Information:
+Portable.NET hungs on this sample too.