[Gtk-sharp-list] Gdk.DrawPoints() is broken on Windows [Was: Gtk-Sharp throws exception on Windows]

Hongli Lai h.lai at chello.nl
Fri Oct 6 03:01:33 EDT 2006

Hongli Lai wrote:
> I'm currently writing a Gtk-Sharp app using Mono on Linux. It's supposed 
> to also work on Windows.
> But when I run the program, it throws an exception:
> Method not found: Void Gdk.Drawable.DrawPoints(Gdk.GC, Gdk.Point[]).:
>     at FieldEditor.FieldView.RenderToDrawable(Field field, 
> FieldSelection region, FieldSelection selection, UInt32 zoomLevel, 
> Drawable drawable)
>     at FieldEditor.FieldView.OnExposed(Object o, ExposeEventArgs args)
>     at Gtk.Widget.ExposeEventSignalCallback(IntPtr arg0, IntPtr arg1, 
> IntPtr gch)
>     at Gtk.Application.gtk_main()
>     at Gtk.Application.Run()
>     at FieldEditor.MainClass.Main(String[] args)
> This is weird. The program can create Gtk windows and widgets correctly, 
> yet cannot call Gdk functions. Did I do something wrong or is this a bug 
> in Gtk-Sharp?
> Extra information:
> - The program's source code is located at 
> http://svn.sourceforge.net/viewvc/openkore/field-editor/trunk/
> - A binary is available here: http://www.openkore.com/misc/FieldEditor.zip
> - To use the program you need a random .fld file, available here: 
> http://svn.sourceforge.net/viewvc/openkore/fieldpack/trunk/fields/
> - I'm using .Net framework 2.0 and Gtk-Sharp 2.7.1-0.4
> - The .exe was compiled as follows: mcs 
> -pkg:gtk-sharp-2.0,glade-sharp-2.0 *.cs -out:bin/Release/FieldEditor.exe 
> -target:winexe -optimize

I figured out what causes this problem: the Gtk-Sharp included with Mono has a different function definition for Gdk.DrawPoints than the 
Gtk-Sharp for Windows (2.7.1-0.4).

On Linux, it's defined (correctly) as follows:
Gdk.DrawPoints(Gdk.Drawable target, Point[] points)

On Windows, it's defined (INCORRECTLY!) as follows:
Gdk.DrawPoints(Gdk.Drawable target, Point points, int npoints)

The latter is obviously wrong. It seems to be a direct translation of 
the C interface, which expects an array. It can't be used in C#.

More information about the Gtk-sharp-list mailing list