Re: Making GModule use GError.



Hi Owen,

> > to achieve a greater consistency (at the cost of backward compatibility) I
> > make the proposal to let GModule use GError functions instead of the rather
> > bad (IMHO) g_module_error () func. Attached is a patch, that implements it for
> > now only for gmodule-dl.c (i.e. Linux, Solaris, etc.), but if approved I would
> > of course change it for the other platforms too and the documentation as well.
> >
> > For now I only introduced 3 errors:
> >
> > G_MODULE_ERROR_UNKNOWN_SYMBOL,
> > G_MODULE_ERROR_INIT_CHECK,
> > G_MODULE_ERROR_FAILED
> >
> > because in fact dl_error doesn't give us error codes (extremely stupid in the
> > first place, I think!), so we can not be any more precise (only in string
> > format again, which we simply copy from dl_error).
> 
> While GModule would use GError if written from scratch, I tend to
> think that the consistency benefits of changing at this point
> are not worth breaking substantial amounts of existing code;
> I don't think there is any real gain in functionality from
> this.

While in principle you're right, I still don't like this g_module_error thing
much and the change really is just writing "GError *error;" at the function
start, appending ",&error" to the parameters and replacing "g_module_error()"
with "error->message". And I really supose, that we change it someday anyway.
But I count your No-vote and hope for Yes-votes from Havoc and Tim (hint,
hint). (Voting seems quite popular these days.)

> (I guess the one gain in functionality is proper threaded operation,
> but dlerror() probably uses per-thread data on thread-safe
> C libraries anyways.)

That already worked before actually, but with a GStaticPrivate hack.

Bye,
Sebastian
-- 
Sebastian Wilhelmi
mailto:wilhelmi ira uka de
http://goethe.ira.uka.de/~wilhelmi




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