Re: C++ and glue/gmodule



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

OK, I found out that I can use this glue stuff in C somehow but I need
to call g_type_module_register_type () to register the plugin types
somehow and I did not find a way to the GTypeInfo of the C++ class which
is needed as an argument.

Regards,
Johannes

Johannes Schmid wrote:
> Hi!
> 
> I am working on C++ wrapper for libanjuta which will allow it to write
> Anjuta plugins in C++.
> 
> The last problem I have is that anjuta uses glue/gmodule to load plugins
> and some weird macros in every plugin to export some symbols in the
> plugins. How can I wrap this to C++ in a clean or at least in a working way.
> 
> All plugins derive from Anjuta::Plugin (AnjutaPlugin) and "activate()"
> is called to activate them after the class has been created. But in
> addition this macro is used for the gmodule mechanism:
> 
> #define ANJUTA_SIMPLE_PLUGIN(class_name, prefix)                      \
> G_MODULE_EXPORT void glue_register_components (GluePlugin *plugin);   \
> G_MODULE_EXPORT GType glue_get_component_type (GluePlugin *plugin, const
> char *name); \
> G_MODULE_EXPORT void                                                  \
> glue_register_components (GluePlugin *plugin)                         \
> {                                                                     \
> 	prefix##_get_type (plugin);                                       \
> }                                                                     \
> G_MODULE_EXPORT GType                                                 \
> glue_get_component_type (GluePlugin *plugin, const char *name)        \
> {                                                                     \
> 	if (!strcmp (name, #class_name)) {                                \
> 		return prefix##_get_type (plugin);                            \
> 	} else {                                                          \
> 		return G_TYPE_INVALID;                                        \
> 	}                                                                 \
> }
> 
> Thanks and regards,
> Johannes
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE4DUE7Dsf+G5b/WsRAqvnAJ9verggIszMZwJfGEch2zRE299/SwCdFe6d
yGU0NNovAPvP0HPTuA+G/Jc=
=ywn3
-----END PGP SIGNATURE-----



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]