[Mono-bugs] [Bug 26999][Min] New - 'params' in DllImport function does not work

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
26 Jun 2002 02:40:33 -0000


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 gonzalo@ximian.com.

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

--- shadow/26999	Tue Jun 25 22:40:32 2002
+++ shadow/26999.tmp.27649	Tue Jun 25 22:40:32 2002
@@ -0,0 +1,74 @@
+Bug#: 26999
+Product: Mono/Runtime
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gonzalo@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: 'params' in DllImport function does not work
+
+Description of Problem:
+Trying to use a native function that accepts variable argument list does
+not work.
+
+
+Steps to reproduce the problem:
+1. Just compile and run this program.
+----begin
+using System;
+using System.Runtime.InteropServices;
+
+public class MyClass 
+{
+	[DllImport("glib")]
+	static extern int g_print (string format, params object [] o);
+
+	public static void Main (string [] args)
+	{
+		string name = "Gonzalo";
+		int randomNumber = 69;
+
+		g_print ("Hola %s. Viva el %d!\n", name, randomNumber);
+		g_print ("Ejem!\n", null); // See comments below
+	}
+}
+----end
+
+Actual Results:
+If i don't add the 'null' as argument to the "Ejem" g_print it crashes:
+
+#0  0x080e5ea6 in mono_burg_label_priv (tree=0x0, data=0x81fbddc) at
+codegen-x86.c:6996
+#1  0x080e5ef3 in mono_burg_label_priv (tree=0x81fc794, data=0x81fbddc) at
+codegen-x86.c:7002
+#2  0x080ea1b2 in mono_burg_label (tree=0x81fc794, data=0x81fbddc) at
+codegen-x86.c:9720
+#3  0x080f3ca5 in mono_label_cfg (cfg=0x81fbddc) at emit-x86.c:587
+#4  0x080f614c in arch_jit_compile_cfg (target_domain=0x8172fa0,
+cfg=0x81fbddc) at emit-x86.c:1115
+#5  0x080694b2 in mono_compile_method (method=0x81fb918) at jit.c:3502
+#6  0x080727ac in arch_runtime_invoke (method=0x81fb918, obj=0x0,
+params=0xbffff6f8, exc=0xbffff77c)
+    at invoke.c:223
+#7  0x08100428 in mono_runtime_invoke (method=0x81fb918, obj=0x0,
+params=0xbffff6f8, exc=0xbffff77c)
+    at object.c:317
+
+When using the 'null' argument:
+Hola . Viva el 136300320!
+Ejem!
+RESULT: 0
+
+
+Expected Results:
+Hola Gonzalo. Viva el 69!
+Ejem!