[Mono-bugs] [Bug 40297][Nor] Changed - Marshalling works to, but not from libGSL

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Wed, 26 Mar 2003 06:42:43 -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 lupus@ximian.com.

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

--- shadow/40297	Wed Mar 26 03:18:08 2003
+++ shadow/40297.tmp.23008	Wed Mar 26 06:42:42 2003
@@ -3,13 +3,13 @@
 Version: unspecified
 OS: other
 OS Details: 
 Status: NEW   
 Resolution: 
 Severity: Unknown
-Priority: Wishlist
+Priority: Normal
 Component: misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: bsuss_ca@yahoo.ca               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
@@ -92,6 +92,40 @@
 }
 
 <<
 
 ------- Additional Comments From dietmar@ximian.com  2003-03-26 03:18 -------
 This works perfectly with the new JIT
+
+------- Additional Comments From lupus@ximian.com  2003-03-26 06:42 -------
+The program that doesn't work (probably because of bugs in the
+marshaling code) is this:
+using System;
+using System.Runtime.InteropServices;
+
+class GSL
+{
+        [DllImport("libgsl")]
+        static extern complex gsl_complex_sin (complex z);
+
+        public struct complex
+        {
+                [MarshalAs(UnmanagedType.ByValArray, SizeConst=2)]
+                public double[] dat;
+
+                public complex(double re, double im)
+                {
+                        this.dat=new double[] {re,im};
+                }
+        }
+
+        public static void Main()
+        {
+                complex c1 = new complex (3, 4);;
+                complex c2;
+                c2=gsl_complex_sin(c1);
+
+                Console.WriteLine(c1.dat[0]);
+                Console.WriteLine(c2.dat[0]);
+        }
+}
+