Oh, now I understand why. According to gcc, "int" is always 32bits on both 32 and 64bits sys. "long" is 32bits on 32 bits sys, and 64bits on 64bits sys. that's compiler-specific, and if I use other compilers, such as visual c++, the result could be different.
On Tue, Jun 9, 2009 at 2:43 PM, Matt Guo <[email protected]> wrote: > 1. in Xlib.h, the c declaration of XDefaultDepth is > extern int XDefaultDepth (Display*, int); > ~~~ ~~~ > and in XplatUIX11.cs, the c# declaration of XDefaultScreen is > internal static extern uint XDefaultDepth (IntPtr display, int > screen_number); > ~~~~ ~~~ > so as I think, in 64bits system, XDefaultDepth will actually return a > 64bits value, and expect the 2nd param is 64bits, however the dllimported > function will return a 32bit number and pass in a 32bit number as the 2nd > param, and wouldn't it cause any problem? There are many other similiar > situation exist when importing other xlib methods. > > 2. in XplatUIX11.cs, > internal extern static IntPtr XWhitePixel(IntPtr display, int screen_no); > ~~~~~~ > internal extern static IntPtr XSetBackground(IntPtr display, IntPtr gc, > UIntPtr background); > > ~~~~~~~ > > but in Xlib.h, the c declaration of a color is always "unsigned long", so > why not just use uint to represent a color in c#, and wouldn't IntPtr cause > a problem in 64bits system? (since IntPtr is 64bits in 64bits system, > however "unsigned long" is still 32 bits). > > > BTW, as I watched, winform seems work fine on 64bits x system (open suse > 11.1 64bits), I'm curious why the expected problems are not triggered? And > I'd appreciate it if someone can help to resolve the confusion, thank you. > > -- > B.R. > GUO Rui (Matt) > > -- B.R. GUO Rui (Matt)
_______________________________________________ Mono-winforms-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-winforms-list
