DEFINITION MODULE FOR "C" GError ; (* m2-GTK4 - GError: the GLib error value. Mapped onto . The C struct is public, so it is modelled directly. Most C APIs take a GError ** out-parameter; in Modula-2 declare a VAR of type GError and pass its address: VAR err: GError; ... err := NIL; ok := g_file_delete(file, NIL, ADR(err)); IF err # NIL THEN ... END; Use GtkUtils.ErrorMessage() to read the message and GtkUtils.ClearError() (or g_error_free) to release it. *) FROM SYSTEM IMPORT ADDRESS; EXPORT UNQUALIFIED GError, GErrorRec, g_error_free, g_error_copy, g_error_matches, g_clear_error; TYPE GError = POINTER TO GErrorRec; (* struct _GError { GQuark domain; gint code; gchar *message; }; *) GErrorRec = RECORD domain: CARDINAL; code: INTEGER; message: ADDRESS; END; (* void g_error_free(GError *error) *) PROCEDURE g_error_free (error: GError); (* GError *g_error_copy(const GError *error) *) PROCEDURE g_error_copy (error: GError) : GError; (* gboolean g_error_matches(const GError *error, GQuark domain, gint code) *) PROCEDURE g_error_matches (error: GError; domain: CARDINAL; code: INTEGER) : [ INTEGER ]; (* void g_clear_error(GError **err) *) PROCEDURE g_clear_error (VAR err: GError); END GError.