[Mono-bugs] [Bug 40297][Wis] New - Marshalling works to, but not from libGSL

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Tue, 25 Mar 2003 23:42:12 -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 bsuss_ca@yahoo.ca.

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

--- shadow/40297	Tue Mar 25 23:42:12 2003
+++ shadow/40297.tmp.30495	Tue Mar 25 23:42:12 2003
@@ -0,0 +1,94 @@
+Bug#: 40297
+Product: Mono/Runtime
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bsuss_ca@yahoo.ca               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Marshalling works to, but not from libGSL
+
+Description of Problem:
+At the suggestion of Paolo Molaro, in regards the thread "Mono and GSL"
+on "Mono-devel-list", I am submitting the following test case that fails on
+Mono 0.23.  Make sure libgsl from the Gnu Scientfic Library is installed. 
+The failure is noted in the comment.  
+
+
+>>
+using System;
+using System.Runtime.InteropServices;
+
+
+class GSL
+{
+	[DllImport("libgsl")]
+	static extern  double gsl_sf_bessel_J0(double x);
+
+	[DllImport("libgsl")]
+	static extern double gsl_complex_abs( complex z);
+
+	[DllImport("libgsl")]
+	static extern complex gsl_complex_sin (complex z);
+
+
+
+public struct complex
+	{
+		public double re;
+		public double im;
+
+		complex(double re, double im) {
+			this.re = re;
+			this.im = im;
+		}
+	}
+
+
+	public static void test()
+	{
+	Console.WriteLine(gsl_sf_bessel_J0(0.0));
+
+	complex c1;
+	//c1.dat=new double[] {3,4};
+	c1.re=3;
+	c1.im=4;
+
+	Console.WriteLine(gsl_complex_abs(c1));
+
+	complex c2;
+	c2=gsl_complex_sin(c1);
+
+
+
+	Console.WriteLine(c2.re);  //should be  3.8537 - 27.0168i
+	Console.WriteLine(c2.im);  // I get something very small instead
+
+
+
+	}
+
+
+
+}
+
+class Tester
+{
+
+
+	static void Main()
+	{
+
+	GSL.test();
+	}
+}
+
+<<