[Mono-devel-list] Mono and GSL

bsuss_ca at yahoo.ca bsuss_ca at yahoo.ca
Mon Mar 24 22:35:42 EST 2003


I've been playing around with getting Mono to work
with the Gnu Scientific
Library (GSL).  I have figured out how to marshall
double functions and complex
functions that return doubles.  However, I have not
been able to get functions
to return complex values.  My successes are
illustrated below and might be
useful to someone.  My failure can be noted by
uncommenting the comment.  If you
have any clue about how to get this to work, it would
be much appreciated.

The complex number is a C struct that looks like:
typedef struct
  double dat[2];
} gsl_complex;

Thanks for any help or suggestions!

Here's my sample code:
using System;
using System.Runtime.InteropServices;

class GSL
	static extern  double gsl_sf_bessel_J0(double x);

	static extern double gsl_complex_abs( complex z);

	static extern complex gsl_complex_sin (complex z);

	public struct complex
		[MarshalAs(UnmanagedType.ByValArray, SizeConst=2)]
		public double[] dat;

		complex(double re, double im)
			this.dat=new double[] {re,im};
	public static void test()

	complex c1;
	c1.dat=new double[] {3,4};

	complex c2;




class Tester

	static void Main()



Post your free ad now! http://personals.yahoo.ca

More information about the Mono-devel-list mailing list