[fpc-pascal] G_TYPE for custom class

Matthias Klumpp matthias at nlinux.org
Fri Nov 6 17:09:40 CET 2009

I have the following part of GLib-C-Code:

typedef struct SomeObject SomeObject;
typedef struct SomeObjectClass SomeObjectClass;

GType some_object_get_type (void);

struct SomeObject
  GObject parent;

struct SomeObjectClass
  GObjectClass parent;

#define SOME_TYPE_OBJECT              (some_object_get_type ())
#define SOME_OBJECT(object)           (G_TYPE_CHECK_INSTANCE_CAST
((object), SOME_TYPE_OBJECT, SomeObject))
#define SOME_OBJECT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass),
SOME_TYPE_OBJECT, SomeObjectClass))
((object), SOME_TYPE_OBJECT))
#define SOME_IS_OBJECT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass),
SOME_TYPE_OBJECT, SomeObjectClass))

G_DEFINE_TYPE(SomeObject, some_object, G_TYPE_OBJECT)

gboolean some_object_hello_world (SomeObject *obj, const char
*hello_message, char ***ret, GError **error);

The class can be translated to Pascal using a record, but how do I create a
custom G_TYPE for my class in Pascal?
Thanks for help with this! (I use this code to make a small GLib-DBus
implementation for Pascal, but it fails if I just submit a G_TYPE_OBJECT as

More information about the fpc-pascal mailing list