Re: [gtkmm] Glib::Module API issues
- From: Vladislav Grinchenko <vgrinche integ com>
- To: Ross Burton <r burton 180sw com>
- Cc: Gtkmm List <gtkmm-list gnome org>
- Subject: Re: [gtkmm] Glib::Module API issues
- Date: 21 Mar 2003 13:56:09 -0500
Ross,
instead of throwing exception from the constructor, you might provide
both operator void*() and operator!() to test if object creation was
successful. This way, those who don't use exceptions in their code
(mostly multi-threads apps), can still find out if object was
successfully *constructed*. It would work smthng like:
A* ap = new A();
if (!ap) {
// failed to initialize
delete ap;
ap = NULL;
}
-Vlad
P.S. I use it everywhere through out my lib. For example:
http://libassa.sourceforge.net/assa-reference/classASSA_1_1Address.html
On Fri, 2003-03-21 at 10:03, Ross Burton wrote:
> Hi,
>
> I'm using Glib::Module to load C++ objects from .so files at runtime --
> the good news is that it works. However, there appears to be a problem
> with the wrapping.
>
> The C API is:
>
> GModule* g_module_open (const gchar *file_name, GModuleFlags flags);
>
> Returns a GModule*, or NULL on failure.
>
> However, the C++ API:
>
> Glib::Module::Module (const std::string& file_name, ModuleFlags flags);
>
> If I use the constructor directly, I can't have a null GModule on the
> stack. If I use new, then I don't seem to get a null pointer even if I
> try and load a module which doesn't exist.
>
> I've compared module.hg and gtk/window.hg, and the way they declare the
> constructor wrapping is totally different. Of course, not being a gtkmm
> wrapping wizzard, this could be intentional. But as Glib::Module isn't a
> commonly used class, I guess this sort of bug could have gone unnoticed.
>
> So, is there a bug in the wrapping? Or am I going mad...
>
> Regards,
> Ross
> --
> Ross Burton Software Engineer
> OneEighty Software Ltd Tel: +44 20 8680 8712
> Cygnet House Fax: +44 20 8680 8453
> 12-14 Sydenham Road r burton 180sw com
> Croydon, Surrey CR9 2ET, UK http://www.180sw.com./
> ====================================================================
> Under the Regulation of Investigatory Powers (RIP) Act 2000 together
> with any and all Regulations in force pursuant to the Act OneEighty
> Software Ltd reserves the right to monitor any or all incoming or
> outgoing communications as provided for under the Act
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
--
_____________________________________________________________
Vladislav Grinchenko e-mail (w): vgrinche integ com
Software Engineer (h): vladg erols com
Integral Systems, Inc. http: www.integ.com
"Focus on quality, and productivity will follow." C. Jones
_____________________________________________________________
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]