[Mono-list] Using Mono

Daniel Carrera dcarrera@math.toronto.edu
Thu, 28 Mar 2002 17:34:13 -0500 (EST)


Hello,

Thanks for helping me install Mono.  Now I'm writing my first C#
programs.

Could someone help me write/compile/use the following library:

public class Complex {

	private double Real = 0;
	private double Imaginary = 0;

	// Do constructors *must* have the same name as the class?
	public Complex(double Re, double Imag) {
		this.Real = Re;
		this.Imaginary = Imag;
	}
}


I compile this with "mcs --target library Complex.cs" and it creates
"Complex.dll"

Then I wrote a program to use it:

class CompExample {
	static void Main() {
		Complex comp1 = new Complex(1,2);
	}
}

1) First question:

   Is this the right way to compile my test program?

prompt]$ mcs -r Complex.dll ExampleComp.cs
RESULT: 0


2) Second quesiton:

   How do I tell Mono to look for the library in the current directory?

prompt]$ mono ExampleComp.exe

(process:13123): ** WARNING **: Could not find assembly Complex
/usr/local/lib/Complex.dll
Can not open image ExampleComp.exe


3) Third question:
   I su'd and copied the dll to /usr/local/lib.
   what does the following error mean?

prompt]$ mono ExampleComp.exe

(process:13083): ** WARNING **: tree does not match
 (STIND_R8 (ADD (LDIND_REF ADDR_L[1]) CONST_I4) CONST_I4)

        (STIND_R8 (ADD (LDIND_REF ADDR_L[1]) CONST_I4) CONST_I4)
        (STIND_R8 (ADD (LDIND_REF ADDR_L[1]) CONST_I4) CONST_I4)
        (CALL_VOID (LDIND_REF ADDR_L[1]) ADDR_G)
        (STIND_R8 (ADD (LDIND_REF ADDR_L[1]) CONST_I4) (LDIND_R8
ADDR_L[2]))
        (STIND_R8 (ADD (LDIND_REF ADDR_L[1]) CONST_I4) (LDIND_R8
ADDR_L[3]))
        RET_VOID

(process:13083): ** ERROR **: file emit-x86.c: line 327 (mono_label_cfg):
should not be reached
aborting...
Aborted





Thanks for the help,
Daniel.