MAN Solaris - glib-genmarshal (1)



glib-genmarshal - generates C code marshallers for GLib closures



glib-genmarshal [--body] [--g-fatal-warnings] [--header] [--help] [--internal] [--nostdinc | --stdinc] [--prefix=dir] [--skip-source] [--version] [file...]




glib-genmarshal generates C code marshallers for callback functions of the GClosure mechanism in the GObject sublibrary of GLib. The marshaller functions have a standard signature. The following are passed to the marshaller functions: the invoking closure, an array of value structures holding the callback function parameters, and a value structure for the return value of the callback. The marshaller then calls the C code function of the closure with all of the parameters on the stack, and collects the return value.

glib-genmarshal generates the specified list of marshallers. The marshaller list is either read from standard input or from files passed as additional arguments on the command line.


The marshaller lists are processed line by line. A line can contain a comment in the following format:

# this is a comment

A marshaller list can contain a marshaller specification in the following format:

# up to 16 PTYPEs may be present

RTYPE specifies the callback return type. PTYPE specifies the callback parameter list, except for the first and the last arguments which are always pointers.

    Parameter Types

Currently, the following parameter types are supported:

BOOL Deprecated alias for BOOLEAN.

BOOLEAN Boolean type (gboolean).

BOXED Boxed, anonymous but reference counted, type (GBoxed*).

CHAR Signed char type (gchar).

DOUBLE Double-precision float type (gdouble).

ENUM Enumeration type (gint).

FLAGS Flag enumeration type (guint).

FLOAT Single-precision float type (gfloat).

INT Signed integer type (gint).

INT64 Signed 64bit integer type (gint64).

LONG Signed long integer type (glong).

NONE Deprecated alias for VOID.

OBJECT GObject or derived type (GObject*).

PARAM GParamSpec or derived type (GParamSpec*).

POINTER Anonymous pointer type (gpointer).

STRING String type (gchar*).

UCHAR Unsigned char type (guchar).

UINT Unsigned integer type (guint).

UINT64 Unsigned 64bit integer type (guint64).

ULONG Unsigned long integer type (gulong).

VOID No return type, or no extra parameters. If VOID is used as the parameter list, no additional parameters may be present.


The following options are supported:

--body Generate the C code file contents of the marshallers.

--g-fatal-warnings Make warnings fatal, that is, exit immediately once a warning occurs.

--internal Mark generated functions as internal.

--header Generate the header file contents of the marshallers.

-h, --help Show usage and basic help information.

--nostdinc Do not use the standard marshallers of the GObject library, and skip the gmarshal.h include directive in generated header files.

--stdinc Use the standard marshallers of the GObject library, and use the gmarshal.h include directive in generated header files.

--prefix=dir Specify the marshaller prefix. The default prefix is g_cclosure_marshal.

--skip-source Skip source location remarks in generated comments.

-v, --version Show version information.


The following operands are supported:

file Specifies the marshaller to be generated.


Example 1: Generating Marshallers

This example shows how to generate marshallers for the following callback functions:

void     foo (gpointer data1,
              gpointer data2);
void     bar (gpointer data1,
              gint param1,
              gpointer data2);
gfloat   baz (gpointer data1,
              gboolean param1,
              guchar param2,
              gpointer data2);

The marshaller list is as follows:


The generated marshallers have the arguments encoded in their function name. For this particular list, they are as follows:


The generated marshallers can be used directly for GClosures or can be passed in as the GSignalCMarshaller c_marshaller; argument upon creation of signals:

GClosure *cc_foo, *cc_bar, *cc_baz;

cc_foo = g_cclosure_new (NULL, foo, NULL); g_closure_set_marshal (cc_foo, g_cclosure_marshal_VOID__VOID); cc_bar = g_cclosure_new (NULL, bar, NULL); g_closure_set_marshal (cc_bar, g_cclosure_marshal_VOID__INT); cc_baz = g_cclosure_new (NULL, baz, NULL); g_closure_set_marshal (cc_baz, g_cclosure_marshal_FLOAT__BOOLEAN_UCHAR);


The following exit values are returned:

0 Application exited successfully

>0 Application exited with failure


The following files are used by this application:

/usr/bin/glib-genmarshal The command-line executable for the application.

/usr/share/gtk-doc/html/glib Location of developer documentation


See attributes(5) for descriptions of the following attributes:

Interface stabilityCommitted


gdk-pixbuf-csource(1), gdk-pixbuf-query-loaders(1), glib-gettextize(1), glib-mkenums(1), gobject-query(1), gtk-query-immodules-2.0(1), gtk-update-icon-cache(1), libglib-2.0(3)


Updated by Brian Cameron, Sun Microsystems Inc., 2003, 2006. Written by Tim Janik.

Jump to page    or go to Top of page |  Section 1 |  Main Solaris Index.

SunOS 5.11 glib-genmarshal (1) 7 Apr 2003
Generated by Open Solaris Forum from /usr/share/man/man1/glib-genmarshal.1 using man macros with tbl support.