1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
3 * anjuta-glue-cpp.c (c) 2006 Johannes Schmid
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Library General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
20 * SECTION:anjuta-glue-cpp
21 * @title: AnjutaAnjutaGlueCpp
22 * @short_description: C++ Anjuta glue code
24 * @stability: Unstable
25 * @include: libanjuta/anjuta-glue-cpp.h
29 #include "anjuta-glue-cpp.h"
34 typedef GObject
* (*AnjutaGlue_constructor
)();
37 anjuta_glue_cpp_load_plugin(AnjutaGlueFactory
* factory
, const gchar
* component_name
, const gchar
* type_name
)
39 GList
* p
= anjuta_glue_factory_get_path(factory
);
42 plugin_name
= g_module_build_path (NULL
, component_name
);
44 AnjutaGlue_constructor constructor
;
48 const gchar
*file_name
;
49 PathEntry
*entry
= p
->data
;
53 dir
= g_dir_open (entry
->path
, 0, NULL
);
59 file_name
= g_dir_read_name (dir
);
61 if (file_name
&& strcmp (file_name
, plugin_name
) == 0) {
65 /* We have found a matching module */
66 plugin_path
= g_module_build_path (entry
->path
, plugin_name
);
67 module
= g_module_open (plugin_path
, 0);
70 g_warning ("Could not open module: %s\n", g_module_error ());
71 goto move_to_next_dir
;
74 if (!g_module_symbol (module
, "anjuta_glue_constructor", (gpointer
*)&constructor
))
76 g_module_close (module
);
77 goto move_to_next_dir
;
79 /* Create the object */
80 plugin
= (*constructor
)();
83 } while (file_name
!= NULL
);