Imported Upstream version 1.35.9
[platform/upstream/gobject-introspection.git] / examples / glib-print.c
1 #include <girepository.h>
2
3 int
4 main (void)
5 {
6   GIRepository *repository;
7   GError *error = NULL;
8   GIBaseInfo *base_info;
9   GIArgument in_args[5];
10   GIArgument retval;
11
12   repository = g_irepository_get_default ();
13   g_irepository_require (repository, "GLib", "2.0", 0, &error);
14   if (error)
15     {
16       g_error ("ERROR: %s\n", error->message);
17       return 1;
18     }
19
20   base_info = g_irepository_find_by_name (repository, "GLib", "assertion_message");
21   if (!base_info)
22     {
23       g_error ("ERROR: %s\n", "Could not find GLib.warn_message");
24       return 1;
25     }
26
27   in_args[0].v_pointer = "domain";
28   in_args[1].v_pointer = "glib-print.c";
29   in_args[2].v_pointer = "30";
30   in_args[3].v_pointer = "main";
31   in_args[4].v_pointer = "hello world";
32
33   if (!g_function_info_invoke ((GIFunctionInfo *) base_info,
34                                (const GIArgument *) &in_args,
35                                5,
36                                NULL,
37                                0,
38                                &retval,
39                                &error))
40     {
41       g_error ("ERROR: %s\n", error->message);
42       return 1;
43     }
44
45   g_base_info_unref (base_info);
46
47   return 0;
48 }