[Mono-list] Compilation problems mcs (2-dimensional arrays and enums)

Tom Fransen t.fransen@mailned.nl
Tue, 16 Jul 2002 21:32:21 +0100


Hi,

I am writing code on MS and on Mono. While 'porting' my code from MS .NET to
Mono .NET I encountered two problems with the c# code I wrote. I have
written 2 small programs to demonstrate the problem. Before I submit problem
reports for this I would like to know if these problems are already known
problems.

I'm running mono 0.12 on RH 7.3.

----------------------------------------------------------------------------
---------------------
The first programs demonstrates a problem with a enum type which is defined
in an assembly
that is used by another assembly.


The build script:

mcs --target module -o ./MonoTest.dll MonoTestAssembly.cs
mcs --target exe -o ./test.exe -r ./MonoTest.dll main.cs

The output (first compilation unit is ok):

RESULT: 0
main.cs(16) error CS0246: Cannot find type `MonoTest.Test.MyEnum'
Error: Compilation failed
RESULT: 1

The code

MonoTestAssembly.cs
-------------------

namespace MonoTest
{
	public class Test
	{ 	//error CS0246: Cannot find type `Test.MyEnum'
		public enum MyEnum { A, B, C };

		public Test()
		{
		}

	}
}

main.cs
-------

using MonoTest;

namespace MonoTest
{

	public class Test2
	{
		public enum TestEnum2 { X,Y,Z };
	}

	public class TestClass
	{
		static void Main(string[] args)
		{
			Test2.TestEnum2 TheEnum2 = Test2.TestEnum2.X;
			MonoTest.Test.MyEnum TheEnum = MonoTest.Test.MyEnum.A;
		}
	}
}

----------------------------------------------------------------------------
---------------------
The second problem has to do with two dimensional arrays

public class ArrayTest
{
	static void Main(string[] args)
	{

	}
	public ArrayTest()
	{
	}
 	public static float[] ArrayA = new float[] { 1.0F, 2.0F, 3.0F };
	public static float[][] floatArray = new float[3][] { ArrayA, ArrayA,
ArrayA };
	//public static float[][] floatArray2 = new float[3][] { null, null,
ArrayA };
}

mcs --target exe -o ./test.exe main.cs

main.cs(13) error CS0029: Cannot convert implicitly from `float[]' to
`float'
Error: Compilation failed
RESULT: 1

Also the line that is commented out gives a compilation error.

Can anybody tell me if these problems are already solved?

Apart from these problems I was able to 'port' most of the code to Mono
without many (compilation) problems. I also managed to use pinvoke to invoke
a number of methods that are part of a shared library that I have written in
C++ (I use that shared library to read out the pentium time stamp counter).

So keep up the good work
regards,
Tom