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