[Mono-list] Possible bug with casting struct pointers

Daniel Morgan danmorg@sc.rr.com
Sun, 27 Oct 2002 21:15:08 -0500


in mcs/class/makefile.gnu, just remove the line that builds
Mono.Data.TdsClient
-----Original Message-----
From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com]On
Behalf Of Alan West
Sent: Sunday, October 27, 2002 5:36 PM
To: mono-list@ximian.com
Subject: [Mono-list] Possible bug with casting struct pointers


Hi, I've started working on bindings for DirectFB, and seem to have come
across my first bug with mcs using the following code. I got my old Windows
XP hard disk plugged in to try it out in VS.NET and all was fine... mcs I'm
using was built from cvs about a week ago, I was gonna try the current cvs
but it wont build now due to code in the Mono.Data.TdsClient area.

using System;

namespace testapp{
	public unsafe class LibTestAPI{

		struct LibTestStruct{
			void* pData;
			void* pTest1;
		}

		LibTestStruct* the_struct;

		public void Create(){
			IntPtr MyPtr = new IntPtr(0); // Usually created elsewhere
			the_struct = (LibTestStruct*) MyPtr.ToPointer();  // error CS1002
		}
	}

	class TestApp{
		[STAThread]
		static void Main(string[] args){
			LibTestAPI myapi = new LibTestAPI();
			myapi.Create();
		}
	}
}

# mcs --unsafe testapp.cs
syntax error, expecting BASE BOOL BYTE CHAR CHECKED DECIMAL DOUBLE FALSE
FLOAT
INT LONG NEW NULL OBJECT SBYTE SHORT SIZEOF STRING THIS TRUE TYPEOF UINT
ULONG UNCHECKED USHORT VOID OPEN_PARENS TILDE PLUS MINUS BANG BITWISE_AND
STAR OP_INC OP_DEC LITERAL_INTEGER LITERAL_FLOAT LITERAL_DOUBLE
LITERAL_DECIMAL LITERAL_CHARACTER LITERAL_STRING IDENTIFIER
testapp.cs(15) error CS1002: Expecting `;'
Compilation failed: 1 error(s), 0 warnings



_______________________________________________
Mono-list maillist  -  Mono-list@ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list