<s>
The	O
GLib	B-Language
Object	I-Language
System	I-Language
,	O
or	O
GObject	B-Language
,	O
is	O
a	O
free	B-Application
software	I-Application
library	O
providing	O
a	O
portable	O
object	B-Language
system	I-Language
and	O
transparent	O
cross-language	O
interoperability	O
.	O
</s>
<s>
GObject	B-Language
is	O
designed	O
for	O
use	O
both	O
directly	O
in	O
C	B-Language
programs	I-Language
to	O
provide	O
object-oriented	B-Language
C-based	O
APIs	O
and	O
through	O
bindings	O
to	O
other	O
languages	O
to	O
provide	O
transparent	O
cross-language	O
interoperability	O
,	O
e.g.	O
</s>
<s>
PyGObject	B-Language
.	O
</s>
<s>
(	O
abbreviated	O
GIR	O
)	O
is	O
a	O
middleware	O
layer	O
between	O
C	B-Language
libraries	I-Language
(	O
using	O
GObject	B-Language
)	O
and	O
language	B-Application
bindings	I-Application
,	O
cf	O
.	O
</s>
<s>
List	B-Language
of	I-Language
language	I-Language
bindings	I-Language
for	I-Language
GTK	I-Language
.	O
</s>
<s>
Depending	O
only	O
on	O
GLib	B-Language
and	O
libc	B-Language
,	O
GObject	B-Language
is	O
a	O
cornerstone	O
of	O
GNOME	B-Application
and	O
is	O
used	O
throughout	O
GTK	B-Application
,	O
Pango	B-Language
,	O
ATK	B-Language
,	O
and	O
most	O
higher-level	O
GNOME	B-Application
libraries	O
like	O
GStreamer	B-Language
and	O
applications	O
.	O
</s>
<s>
Prior	O
to	O
GTK+	O
2.0	O
,	O
code	O
similar	O
to	O
GObject	B-Language
was	O
part	O
of	O
the	O
GTK	B-Application
codebase	O
.	O
</s>
<s>
(	O
The	O
name	O
“	O
GObject	B-Language
”	O
was	O
not	O
yet	O
in	O
use	O
the	O
common	O
baseclass	O
was	O
called	O
GtkObject	O
.	O
)	O
</s>
<s>
At	O
the	O
release	O
of	O
GTK+	O
2.0	O
,	O
the	O
object	B-Language
system	I-Language
was	O
extracted	O
into	O
a	O
separate	O
library	O
due	O
to	O
its	O
general	O
utility	O
.	O
</s>
<s>
In	O
the	O
process	O
,	O
most	O
non-GUI-specific	O
parts	O
of	O
the	O
GtkObject	O
class	O
were	O
moved	O
up	O
into	O
GObject	B-Language
,	O
the	O
new	B-Language
common	O
baseclass	O
.	O
</s>
<s>
Having	O
existed	O
as	O
a	O
separate	O
library	O
since	O
March	O
11	O
,	O
2002	O
(	O
the	O
release	O
date	O
of	O
GTK+	O
2.0	O
)	O
,	O
the	O
GObject	B-Language
library	O
is	O
now	O
used	O
by	O
many	O
non-GUI	O
programs	O
such	O
as	O
command-line	B-Application
and	O
server	B-Application
applications	I-Application
.	O
</s>
<s>
Though	O
GObject	B-Language
has	O
its	O
own	O
separate	O
set	O
of	O
documentation	O
and	O
is	O
usually	O
compiled	O
into	O
its	O
own	O
shared	O
library	O
file	O
,	O
the	O
source	O
code	O
for	O
GObject	B-Language
resides	O
in	O
the	O
GLib	B-Language
source	O
tree	O
and	O
is	O
distributed	O
along	O
with	O
GLib	B-Language
.	O
</s>
<s>
For	O
this	O
reason	O
,	O
GObject	B-Language
uses	O
the	O
GLib	B-Language
version	O
numbers	O
and	O
is	O
typically	O
packaged	O
together	O
with	O
GLib	B-Language
(	O
for	O
example	O
,	O
Debian	O
puts	O
GObject	B-Language
in	O
its	O
libglib2.0	O
package	O
family	O
)	O
.	O
</s>
<s>
At	O
the	O
most	O
basic	O
level	O
of	O
the	O
GObject	B-Language
framework	O
lies	O
a	O
generic	O
and	O
dynamic	O
type	O
system	O
called	O
GType	B-Language
.	O
</s>
<s>
The	O
GType	B-Language
system	O
holds	O
a	O
runtime	O
description	O
of	O
all	O
objects	O
allowing	O
glue	B-General_Concept
code	I-General_Concept
to	O
facilitate	O
multiple	O
language	B-Application
bindings	I-Application
.	O
</s>
<s>
The	O
type	O
system	O
can	O
handle	O
any	O
singly	O
inherited	O
class	O
structure	O
,	O
in	O
addition	O
to	O
non-classed	O
types	O
such	O
as	O
opaque	O
pointers	O
,	O
strings	O
,	O
and	O
variously	O
sized	O
integers	O
and	O
floating	B-Algorithm
point	I-Algorithm
numbers	I-Algorithm
.	O
</s>
<s>
This	O
is	O
trivial	O
for	O
types	O
like	O
integers	O
,	O
but	O
many	O
complex	O
objects	O
are	O
reference-counted	B-General_Concept
,	O
while	O
some	O
are	O
complex	O
but	O
not	O
reference-counted	B-General_Concept
.	O
</s>
<s>
When	O
the	O
type	O
system	O
“	O
copies	O
”	O
a	O
reference-counted	B-General_Concept
object	O
,	O
it	O
will	O
typically	O
just	O
increase	O
its	O
reference	B-General_Concept
count	I-General_Concept
,	O
whereas	O
when	O
copying	O
a	O
complex	O
,	O
non-reference-counted	O
object	O
(	O
such	O
as	O
a	O
string	O
)	O
,	O
it	O
will	O
typically	O
create	O
an	O
actual	O
copy	O
by	O
allocating	B-General_Concept
memory	I-General_Concept
.	O
</s>
<s>
Such	O
containers	O
are	O
particularly	O
useful	O
when	O
interacting	O
with	O
dynamically	O
typed	O
language	O
environments	O
in	O
which	O
all	O
native	O
values	O
reside	O
in	O
such	O
type-tagged	B-Language
containers	O
.	O
</s>
<s>
These	O
make	O
up	O
a	O
relatively	O
closed	O
set	O
,	O
but	O
although	O
the	O
average	O
user	O
is	O
not	O
expected	O
to	O
create	O
their	O
own	O
fundamental	O
types	O
,	O
the	O
possibility	O
does	O
exist	O
and	O
has	O
been	O
exploited	O
to	O
create	O
custom	O
class	B-Application
hierarchies	I-Application
i.e.	O
,	O
class	B-Application
hierarchies	I-Application
not	O
based	O
on	O
the	O
GObject	B-Language
class	O
.	O
</s>
<s>
As	O
of	O
GLib	B-Language
2.9.2	O
,	O
the	O
non-classed	O
built-in	O
fundamental	O
types	O
are	O
:	O
</s>
<s>
an	O
empty	O
type	O
,	O
corresponding	O
to	O
C	B-Language
's	O
void	O
(	O
G_TYPE_NONE	O
)	O
;	O
</s>
<s>
types	O
corresponding	O
to	O
C	B-Language
's	O
signed	O
and	O
unsigned	O
char	O
,	O
int	O
,	O
long	O
,	O
and	O
64-bit	O
integers	O
(	O
G_TYPE_CHAR	O
,	O
G_TYPE_UCHAR	O
,	O
G_TYPE_INT	O
,	O
G_TYPE_UINT	O
,	O
G_TYPE_LONG	O
,	O
G_TYPE_ULONG	O
,	O
G_TYPE_INT64	O
,	O
and	O
G_TYPE_UINT64	O
)	O
;	O
</s>
<s>
an	O
enumeration	O
type	O
and	O
a	O
“	O
flags	O
”	O
type	O
,	O
both	O
corresponding	O
to	O
C	B-Language
's	O
enum	O
type	O
,	O
but	O
differing	O
in	O
that	O
the	O
latter	O
is	O
only	O
used	O
for	O
bit	O
fields	O
(	O
G_TYPE_ENUM	O
and	O
G_TYPE_FLAGS	O
)	O
;	O
</s>
<s>
types	O
for	O
single	O
-	O
and	O
double-precision	O
IEEE	O
floats	B-Algorithm
,	O
corresponding	O
to	O
C	B-Language
's	O
float	B-Algorithm
and	O
double	O
(	O
G_TYPE_FLOAT	O
and	O
G_TYPE_DOUBLE	O
)	O
;	O
</s>
<s>
a	O
string	O
type	O
,	O
corresponding	O
to	O
C	B-Language
's	O
char	O
*	O
(	O
G_TYPE_STRING	O
)	O
;	O
</s>
<s>
an	O
opaque	O
pointer	O
type	O
,	O
corresponding	O
to	O
C	B-Language
's	O
void	O
*	O
(	O
G_TYPE_POINTER	O
)	O
.	O
</s>
<s>
a	O
type	O
for	O
“	O
parameter	O
specification	O
objects	O
,	O
”	O
which	O
are	O
used	O
in	O
GObject	B-Language
to	O
describe	O
metadata	O
for	O
object	O
properties	O
(	O
G_TYPE_PARAM	O
)	O
.	O
</s>
<s>
An	O
important	O
characteristic	O
of	O
these	O
types	O
is	O
that	O
the	O
first	O
bytes	O
of	O
any	O
instance	O
always	O
contain	O
a	O
pointer	O
to	O
the	O
class	O
structure	O
(	O
a	O
form	O
of	O
virtual	B-Language
table	I-Language
)	O
associated	O
to	O
the	O
type	O
of	O
the	O
instance	O
.	O
</s>
<s>
Enumerated	O
types	O
and	O
“	O
flags	O
”	O
types	O
In	O
general	O
,	O
every	O
enumerated	O
type	O
and	O
every	O
integer-based	O
bitfield	O
type	O
(	O
i.e.	O
,	O
every	O
enum	O
type	O
)	O
that	O
one	O
wishes	O
to	O
use	O
in	O
some	O
way	O
that	O
is	O
related	O
to	O
the	O
object	B-Language
system	I-Language
for	O
example	O
,	O
as	O
the	O
type	O
of	O
an	O
object	O
property	O
should	O
be	O
registered	O
with	O
the	O
type	O
system	O
.	O
</s>
<s>
Typically	O
,	O
the	O
initialization	O
code	O
that	O
takes	O
care	O
of	O
registering	O
these	O
types	O
is	O
generated	O
by	O
an	O
automated	O
tool	O
called	O
glib-mkenums	O
and	O
stored	O
in	O
a	O
separate	O
file	O
.	O
</s>
<s>
To	O
avoid	O
having	O
to	O
subclass	O
GObject	B-Language
,	O
we	O
can	O
create	O
a	O
boxed	O
type	O
to	O
represent	O
this	O
structure	O
,	O
and	O
provide	O
functions	O
for	O
copying	O
and	O
freeing	O
.	O
</s>
<s>
GObject	B-Language
ships	O
with	O
a	O
handful	O
of	O
boxed	O
types	O
wrapping	O
simple	O
GLib	B-Language
data	O
types	O
.	O
</s>
<s>
Another	O
use	O
for	O
boxed	O
types	O
is	O
as	O
a	O
way	O
to	O
wrap	O
foreign	O
objects	O
in	O
a	O
tagged	O
container	O
that	O
the	O
type	O
system	O
can	O
identify	O
and	O
will	O
know	O
how	O
to	O
copy	O
and	O
free	B-Application
.	O
</s>
<s>
Opaque	O
pointer	O
types	O
Sometimes	O
,	O
for	O
objects	O
that	O
need	O
to	O
be	O
neither	O
copied	O
or	O
reference-counted	B-General_Concept
nor	O
freed	O
,	O
even	O
a	O
boxed	O
type	O
would	O
be	O
overkill	O
.	O
</s>
<s>
While	O
such	O
objects	O
can	O
be	O
used	O
in	O
GObject	B-Language
by	O
simply	O
treating	O
them	O
as	O
opaque	O
pointers	O
(	O
G_TYPE_POINTER	O
)	O
,	O
it	O
is	O
often	O
a	O
good	O
idea	O
to	O
create	O
a	O
derived	O
pointer	O
type	O
,	O
documenting	O
the	O
fact	O
that	O
the	O
pointers	O
should	O
reference	O
a	O
particular	O
kind	O
of	O
object	O
,	O
even	O
though	O
nothing	O
else	O
is	O
said	O
about	O
it	O
.	O
</s>
<s>
Class	O
and	O
interface	O
types	O
Most	O
types	O
in	O
a	O
GObject	B-Language
application	O
will	O
be	O
classes	O
in	O
the	O
normal	O
object-oriented	B-Language
sense	O
of	O
the	O
word	O
derived	O
directly	O
or	O
indirectly	O
from	O
the	O
root	O
class	O
,	O
GObject	B-Language
.	O
</s>
<s>
There	O
are	O
also	O
interfaces	B-Application
,	O
which	O
,	O
unlike	O
classic	O
Java-style	O
interfaces	B-Application
,	O
can	O
contain	O
implemented	O
methods	O
.	O
</s>
<s>
GObject	B-Language
interfaces	B-Application
can	O
thus	O
be	O
described	O
as	O
mixins	B-Language
.	O
</s>
<s>
The	O
GObject	B-Language
messaging	O
system	O
consists	O
of	O
two	O
complementary	O
parts	O
:	O
closures	O
and	O
signals	O
.	O
</s>
<s>
Closures	O
A	O
GObject	B-Language
closure	O
is	O
a	O
generalized	O
version	O
of	O
a	O
callback	O
.	O
</s>
<s>
Support	O
exists	O
for	O
closures	O
written	O
in	O
C	B-Language
and	O
C++	B-Language
,	O
as	O
well	O
as	O
arbitrary	O
languages	O
(	O
when	O
bindings	O
are	O
provided	O
)	O
.	O
</s>
<s>
This	O
allows	O
code	O
written	O
in	O
(	O
for	O
example	O
)	O
Python	B-Language
and	O
Java	B-Language
to	O
be	O
invoked	O
via	O
a	O
GObject	B-Language
closure	O
.	O
</s>
<s>
Objects	O
register	O
signal	B-Application
listeners	O
with	O
the	O
type	O
system	O
,	O
specifying	O
a	O
mapping	O
between	O
a	O
given	O
signal	B-Application
and	O
a	O
given	O
closure	O
.	O
</s>
<s>
Upon	O
emission	O
of	O
a	O
registered	O
signal	B-Application
,	O
that	O
signal	B-Application
's	O
closure	O
is	O
invoked	O
.	O
</s>
<s>
In	O
GTK	B-Application
,	O
all	O
native	O
GUI	B-Application
events	O
(	O
such	O
as	O
mouse	O
motion	O
and	O
keyboard	O
actions	O
)	O
can	O
generate	O
GObject	B-Language
signals	O
for	O
listeners	O
to	O
potentially	O
act	O
upon	O
.	O
</s>
<s>
Each	O
GObject	B-Language
class	O
is	O
implemented	O
by	O
at	O
least	O
two	O
structures	O
:	O
the	O
class	O
structure	O
and	O
the	O
instance	O
structure	O
.	O
</s>
<s>
The	O
class	O
structure	O
The	O
class	O
structure	O
corresponds	O
to	O
the	O
vtable	B-Language
of	O
a	O
C++	B-Language
class	O
.	O
</s>
<s>
Following	O
that	O
,	O
it	O
will	O
hold	O
a	O
set	O
of	O
function	O
pointers	O
one	O
for	O
each	O
virtual	B-Application
method	I-Application
of	O
the	O
class	O
.	O
</s>
<s>
After	O
the	O
data	O
belonging	O
to	O
the	O
superclass	O
,	O
the	O
structure	O
can	O
hold	O
any	O
instance-specific	O
variables	O
,	O
corresponding	O
to	O
C++	B-Language
member	O
variables	O
.	O
</s>
<s>
Defining	O
a	O
class	O
in	O
the	O
GObject	B-Language
framework	O
is	O
complex	O
,	O
requiring	O
large	O
amounts	O
of	O
boilerplate	O
code	O
,	O
such	O
as	O
manual	O
definitions	O
of	O
type	O
casting	O
macros	O
and	O
obscure	O
type	O
registration	O
incantations	O
.	O
</s>
<s>
Also	O
,	O
since	O
a	O
C	B-Language
structure	O
cannot	O
have	O
access	O
modifiers	O
like	O
“	O
public	O
”	O
,	O
“	O
protected	O
”	O
,	O
or	O
“	O
private	O
”	O
,	O
workarounds	O
must	O
be	O
used	O
to	O
provide	O
encapsulation	B-Application
.	O
</s>
<s>
If	O
the	O
private	O
structure	O
is	O
registered	O
with	O
GType	B-Language
,	O
it	O
will	O
be	O
automatically	O
allocated	O
by	O
the	O
object	B-Language
system	I-Language
.	O
</s>
<s>
To	O
address	O
some	O
of	O
these	O
complexities	O
,	O
several	O
higher-level	O
languages	O
exist	O
that	O
source-to-source	B-Language
compiles	I-Language
to	O
GObject	B-Language
in	O
C	B-Language
.	O
The	O
Vala	B-Language
programming	I-Language
language	I-Language
uses	O
a	O
C#	B-Application
-style	O
syntax	O
and	O
is	O
pre-processed	O
into	O
vanilla	B-General_Concept
C	B-Language
code	O
.	O
</s>
<s>
The	O
GObject	B-Language
Builder	O
,	O
or	O
,	O
offers	O
a	O
template	O
syntax	O
reminiscent	O
of	O
Java	B-Language
.	O
</s>
<s>
The	O
combination	O
of	O
C	B-Language
and	O
GObject	B-Language
is	O
used	O
in	O
many	O
successful	O
free	B-Application
software	I-Application
projects	O
,	O
such	O
as	O
the	O
GNOME	B-Application
desktop	I-Application
,	O
the	O
GTK	B-Application
toolkit	I-Application
and	O
the	B-Application
GIMP	I-Application
image	O
manipulation	O
program	O
.	O
</s>
<s>
Though	O
many	O
GObject	B-Language
applications	O
are	O
written	O
entirely	O
in	O
C	B-Language
,	O
the	O
GObject	B-Language
system	O
maps	O
well	O
into	O
the	O
native	O
object	B-Language
systems	I-Language
of	O
many	O
other	O
languages	O
,	O
like	O
C++	B-Language
,	O
Java	B-Language
,	O
Ruby	B-Language
,	O
Python	B-Language
,	O
Common	B-Language
Lisp	I-Language
,	O
and	O
.NET/Mono	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
it	O
is	O
usually	O
relatively	O
painless	O
to	O
create	O
language	B-Application
bindings	I-Application
for	O
well-written	O
libraries	O
that	O
use	O
the	O
GObject	B-Language
framework	O
.	O
</s>
<s>
Writing	O
GObject	B-Language
code	O
in	O
C	B-Language
in	O
the	O
first	O
place	O
,	O
however	O
,	O
is	O
relatively	O
verbose	O
.	O
</s>
<s>
The	O
library	O
takes	O
a	O
good	O
deal	O
of	O
time	O
to	O
learn	O
,	O
and	O
programmers	O
with	O
experience	O
in	O
high-level	O
object-oriented	B-Language
languages	I-Language
often	O
find	O
it	O
somewhat	O
tedious	O
to	O
work	O
with	O
GObject	B-Language
in	O
C	B-Language
.	O
For	O
example	O
,	O
creating	O
a	O
subclass	O
(	O
even	O
just	O
a	O
subclass	O
of	O
GObject	B-Language
)	O
can	O
require	O
writing	O
and/or	O
copying	O
large	O
amounts	O
of	O
boilerplate	O
code	O
.	O
</s>
<s>
However	O
,	O
using	O
Vala	B-Language
,	O
a	O
language	O
that	O
is	O
designed	O
primarily	O
to	O
work	O
with	O
GObject	B-Language
and	O
which	O
converts	O
to	O
C	B-Language
,	O
is	O
likely	O
to	O
make	O
working	O
with	O
GObject	B-Language
or	O
writing	O
GObject	B-Language
based	O
libraries	O
nicer	O
.	O
</s>
<s>
Although	O
they	O
are	O
not	O
really	O
first-class	O
objects	O
(	O
there	O
are	O
no	O
actual	O
metatypes	O
in	O
GType	B-Language
)	O
,	O
metaobjects	O
like	O
classes	O
and	O
interfaces	B-Application
are	O
created	O
by	O
GObject	B-Language
applications	O
at	O
runtime	O
,	O
and	O
provide	O
good	O
support	O
for	O
introspection	B-Application
.	O
</s>
<s>
Since	O
GObject	B-Language
provides	O
a	O
mostly	O
complete	O
object	B-Language
system	I-Language
for	O
C	B-Language
,	O
it	O
can	O
be	O
seen	O
as	O
an	O
alternative	O
to	O
C-derived	O
languages	O
such	O
as	O
C++	B-Language
and	O
Objective-C	B-Language
.	O
(	O
Though	O
both	O
also	O
offer	O
many	O
other	O
features	O
beyond	O
just	O
their	O
respective	O
object	B-Language
systems	I-Language
.	O
)	O
</s>
<s>
An	O
easily	O
observed	O
difference	O
between	O
C++	B-Language
and	O
GObject	B-Language
is	O
that	O
GObject	B-Language
(	O
like	O
Java	B-Language
)	O
does	O
not	O
support	O
multiple	B-Application
inheritance	I-Application
.	O
</s>
<s>
GObject	B-Language
's	O
use	O
of	O
GLib	B-Language
's	O
g_malloc( )	O
memory	B-General_Concept
allocation	I-General_Concept
function	O
will	O
cause	O
the	O
program	O
to	O
exit	O
unconditionally	O
upon	O
memory	O
exhaustion	O
,	O
unlike	O
the	O
C	B-Language
library	I-Language
's	O
malloc( )	O
,	O
C++'s	O
new	B-Language
,	O
and	O
other	O
common	O
memory	B-General_Concept
allocators	I-General_Concept
which	O
allow	O
a	O
program	O
to	O
cope	O
with	O
or	O
even	O
fully	O
recover	O
from	O
out-of-memory	O
situations	O
without	O
simply	O
crashing	O
.	O
</s>
<s>
This	O
tends	O
to	O
work	O
against	O
including	O
GObject	B-Language
in	O
software	O
where	O
resilience	O
in	O
the	O
face	O
of	O
limited	O
memory	O
is	O
important	O
,	O
or	O
where	O
very	O
many	O
or	O
very	O
large	O
objects	O
are	O
commonly	O
handled	O
.	O
</s>
<s>
The	O
g_try_new( )	O
can	O
be	O
used	O
when	O
a	O
memory	B-General_Concept
allocation	I-General_Concept
is	O
more	O
likely	O
to	O
fail	O
(	O
for	O
a	O
large	O
object	O
for	O
example	O
)	O
,	O
but	O
this	O
cannot	O
grant	O
that	O
the	O
allocation	O
will	O
not	O
fail	O
elsewhere	O
in	O
the	O
code	O
.	O
</s>
<s>
Another	O
important	O
difference	O
is	O
that	O
while	O
C++	B-Language
and	O
Objective-C	B-Language
are	O
separate	O
languages	O
,	O
GObject	B-Language
is	O
strictly	O
a	O
library	O
and	O
as	O
such	O
does	O
not	O
introduce	O
any	O
new	B-Language
syntax	O
or	O
compiler	O
intelligence	O
.	O
</s>
<s>
For	O
example	O
,	O
when	O
writing	O
GObject-based	O
C	B-Language
code	O
,	O
it	O
is	O
frequently	O
necessary	O
to	O
perform	O
explicit	O
upcasting	O
.	O
</s>
<s>
Hence	O
,	O
“	O
C	B-Language
with	O
GObject	B-Language
”	O
,	O
considered	O
as	O
a	O
language	O
separate	O
from	O
plain	O
C	B-Language
,	O
is	O
a	O
strict	O
superset	O
of	O
plain	O
C	B-Language
—	O
like	O
Objective	B-Language
C	I-Language
,	O
but	O
unlike	O
C++	B-Language
.	O
</s>
<s>
On	O
platforms	O
where	O
there	O
is	O
no	O
standard	O
ABI	B-Operating_System
that	O
works	O
across	O
all	O
C++	B-Language
compilers	O
(	O
which	O
is	O
not	O
usually	O
the	O
case	O
,	O
since	O
either	O
the	O
Itanium	O
ABI	B-Operating_System
or	O
the	O
Microsoft	O
ABI	B-Operating_System
are	O
usually	O
followed	O
)	O
,	O
a	O
library	O
compiled	O
with	O
one	O
C++	B-Language
compiler	O
is	O
not	O
always	O
able	O
to	O
call	O
a	O
library	O
compiled	O
with	O
a	O
different	O
one	O
.	O
</s>
<s>
If	O
such	O
compatibility	O
is	O
required	O
,	O
the	O
C++	B-Language
methods	O
must	O
be	O
exported	O
as	O
plain	O
C	B-Language
functions	I-Language
,	O
partly	O
defeating	O
the	O
purpose	O
of	O
the	O
C++	B-Language
object	B-Language
system	I-Language
.	O
</s>
<s>
The	O
problem	O
occurs	O
in	O
part	O
because	O
different	O
C++	B-Language
compilers	O
use	O
different	O
kinds	O
of	O
name	B-Language
mangling	I-Language
to	O
ensure	O
the	O
uniqueness	O
of	O
all	O
exported	O
symbols	O
.	O
</s>
<s>
(	O
This	O
is	O
necessary	O
because	O
,	O
for	O
example	O
,	O
two	O
different	O
classes	O
may	O
have	O
identically	O
named	O
member	O
functions	O
,	O
one	O
function	O
name	O
may	O
be	O
overloaded	B-Language
multiple	O
times	O
,	O
or	O
identically	O
named	O
functions	O
may	O
appear	O
in	O
different	O
namespaces	O
,	O
but	O
in	O
object	B-Language
code	I-Language
these	O
overlaps	O
are	O
not	O
allowed	O
.	O
)	O
</s>
<s>
In	O
contrast	O
,	O
since	O
C	B-Language
does	O
not	O
support	O
any	O
form	O
of	O
overloading	O
or	O
namespacing	O
,	O
authors	O
of	O
C	B-Language
libraries	I-Language
will	O
typically	O
use	O
explicit	O
prefixes	O
to	O
ensure	O
the	O
global	O
uniqueness	O
of	O
their	O
exported	O
names	O
.	O
</s>
<s>
Hence	O
,	O
despite	O
being	O
object-oriented	B-Language
,	O
a	O
GObject-based	O
library	O
written	O
in	O
C	B-Language
will	O
always	O
use	O
the	O
same	O
external	O
symbol	O
names	O
regardless	O
of	O
which	O
compiler	O
is	O
used	O
.	O
</s>
<s>
Perhaps	O
the	O
most	O
profound	O
difference	O
is	O
GObject	B-Language
's	O
emphasis	O
on	O
signals	O
(	O
called	O
events	O
in	O
other	O
languages	O
)	O
.	O
</s>
<s>
This	O
emphasis	O
derives	O
from	O
the	O
fact	O
that	O
GObject	B-Language
was	O
specifically	O
designed	O
to	O
meet	O
the	O
needs	O
of	O
a	O
GUI	B-Application
toolkit	O
.	O
</s>
<s>
Whilst	O
there	O
are	O
signal	B-Application
libraries	O
for	O
most	O
object-oriented	B-Language
languages	I-Language
out	O
there	O
,	O
in	O
the	O
case	O
of	O
GObject	B-Language
it	O
is	O
built	O
into	O
the	O
object	B-Language
system	I-Language
.	O
</s>
<s>
Because	O
of	O
this	O
,	O
a	O
typical	O
GObject	B-Language
application	O
will	O
tend	O
to	O
use	O
signals	O
to	O
a	O
much	O
larger	O
extent	O
than	O
a	O
non-GObject	O
application	O
would	O
,	O
making	O
GObject	B-Language
components	O
much	O
more	O
encapsulated	B-Application
and	O
reusable	O
than	O
the	O
ones	O
using	O
plain	O
C++	B-Language
or	O
Java	B-Language
.	O
</s>
<s>
If	O
using	O
glibmm/gtkmm	O
,	O
the	O
official	O
C++	B-Language
wrappers	O
to	O
Glib/GTK	O
respectively	O
,	O
the	O
sibling	O
project	O
libsigc++	B-Language
allows	O
easy	O
use	O
of	O
underlying	O
GObject	B-Language
signals	O
using	O
standard	O
C++	B-Language
.	O
</s>
<s>
Of	O
course	O
,	O
other	O
implementations	O
of	O
signals	O
are	O
available	O
on	O
almost	O
all	O
platforms	O
,	O
although	O
sometimes	O
an	O
extra	O
library	O
is	O
needed	O
,	O
such	O
as	O
Boost.Signals2	O
for	O
C++	B-Language
.	O
</s>
