Oct 09, 2007

Compare

Do you see any difference?

using GLib;

namespace Cairo
{
public class Rectangle
: Object
{

public Rectangle (construct double X, construct double Y,
construct double Width, construct double Height)
{
}

public double X
{
get;
set construct;
}

public double Y
{
get;
set construct;
}

public double Width
{
get;
set construct;
}

public double Height
{
get;
set construct;
}

public static bool Equals (Rectangle rectangle, Rectangle other)
{
return rectangle.X == other.X && rectangle.Y == other.Y
&& rectangle.Width == other.Width && rectangle.Height == other.Height;
}

public static bool NotEquals (Rectangle rectangle, Rectangle other)
{
return !(Rectangle.Equals (rectangle, other));
}
}
}

First is C# code, second is Vala code. Object oriented GObject syntax.

Use:

valac --pkg=cairo Rectangle.vala

Then:

gcc `pkg-config --libs glib-2.0 --cflags glib-2.0` -I . Rectangle.c -shared -o rectangle.so

enjoy