[Top][All Lists]

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

Re: lt_dlcaller_set_data interface question

From: Ralf Wildenhues
Subject: Re: lt_dlcaller_set_data interface question
Date: Fri, 7 Sep 2007 19:09:57 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

Hello Eric,

Thanks for the problem report and analysis.

* Eric Blake wrote on Wed, Sep 05, 2007 at 08:18:17PM CEST:
> Ultimately, this boils down to an interface question of what should happen if 
> prior errors are ignored:
> Is this a bug in m4, for not calling lt_dlerror to clear errors after any 
> time 
> lt_dlsym returns NULL?

I would say yes.  The description of lt_dlerror is, albeit very
implicitly, stating this, too:

|  -- Function: const char * lt_dlerror (void)
|      Return a human readable string describing the most recent error
|      that occurred from any of libltdl's functions.  Return `NULL' if
|      no errors have occurred since initialization or since it was last
|      called.

If unsure, IMHO we should go by the known precedent `errno' interface:
you should reset it before a call, and regard its contents to be
well-defined only after an API function failed, except where noted

> Or is it a bug in libtool, for not resetting all prior errors on entry to 
> lt_dlcaller_set_data?

No, that's inefficient.  I'm not even sure whether it would raise more
questions with respect to locking if libltdl were used in a threaded

> And for this particular case, there is a third option:
> Maybe it is worth an interface change in the case of lt_dlcaller_set_data?

IMHO no.  Nothing is worth an interface change over a released stable
version unless there is very very good reason to do so.  libltdl has
already seen way too many interface changes for the small library that
it is.  Anyway, while I see how lt_dlcaller_set_data is special in that
the return type does not necessarily reveal failure, it is not the only
such function in libltdl.  I just learned from a recent thread that some
systems allow dlsym to return a NULL value for a valid symbol (although
I still don't understand what a symbol at position NULL is good for).
This is consistent with errno semantics BTW (quoting from GNU/Linux
error(3) manpage):

| Sometimes, when -1 is also a valid successful return value one has to
| zero errno before the call in order to detect possible errors.

Hope that helps.  And no, I'm not sure libltdl follows the above
reasoning consistently, but reports where it fails to do so are
certainly appreciated.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]