[fpc-pascal] Something like g_object_get() in Pascal?

Matthias Klumpp matthias at nlinux.org
Sun Aug 1 14:45:21 CEST 2010

I have a record containing a set of variables. This record should now be
accessed from an application developed in C (through a shared library).
Because Pascal records are incompatible with C structs, I could write a
get_value() function for each value in the record, e.g. if I have:

TTestRec = record
 val1: String;
 val2: Integer;

I would have to write functions like:
function testrec_get_val1(rec: TTestRec): String;
function testrec_get_val2(rec: TTestRec): Integer;

Now the record consists of a lot more than just two properties. The
GObject type system knows a much better way for accessing properties:
(refer to
I just write the property name as string and add a pointer to the result

int i;
g_object_get(testrec, "val2", &i, NULL);

Is there a possibility to get the same function in Pascal to? That I just
define one get_value() function which receives the property name as string
and outputs the value of it?
Thanks & kind regards

More information about the fpc-pascal mailing list