Re: recent gmodule.c change



On Tue, 18 Jan 2000, Martin Baulig wrote:

> On Saturday, Jan 15, Tim Janik wrote:
> 
> > what is the exact intend of this?
> > either you extern a function g_module_check_init() in a module,
> > and then have to expect to have it called, or you don't, in which
> > case the symbol will not be found.
> > the only case i can imagine where check_init() will be NULL is with
> > something like:          
> 
> Hello,
> 
> sorry for committing to glib without asking first ....
> 
> The problem was that on NetBSD g_module_symbol () doesn't work reliably as
> it is supposed to; sometimes you get a TRUE return value even if the
> symbol was not found.
> 
> Unfortunately this can't be fixed in an easy way since dlsym () just
> returns NULL when the symbol cannot be found, but doesn't set errno != 0
> (dlerr () doesn't seem to exist; at least it's #ifdef'ed to g_strerror
>  (errno) at the top of gmodule-dl.c).
> 
> So there is no way to distinguish whether the symbol wasn't found or
> whether it's NULL; in both cases g_module_symbol will return TRUE but
> `check_init' is NULL.
> 
> We can't simply set an error condition in this case since this'd break
> in all cases when a symbol is really NULL.
> 
> IMO it isn't a big problem to double-check whether `check_init' is NULL
> before calling it, this is just one single line of code and it avoids that
> every single application using gmodule dies a horrible death on NetBSD.

sure, it's the one line that is the problem here, just meant to understand
the reasoning ;)

but to get a consistent interface for g_module_symbol() across all platforms,
we may want to error out on NULL symbols anyways (for 1.4 that is), i should
probably search for g_module_symbol on gnome's LXR to see whether there's
actually code out there that relies on retriving NULL symbols.

---
ciaoTJ



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