Date: Mon, 31 Oct 2005 05:39:21 -0800 (PST) From: Rob <spamrefuse@yahoo.com> To: Igor Robul <igorr@speechpro.com>, freebsd-questions@freebsd.org Subject: Re: dlopen()/dlsym()/dlerror() was: Re: libXcursor.so.1.0.2 reference in libX11.so.6 ?? Message-ID: <20051031133921.20253.qmail@web36209.mail.mud.yahoo.com> In-Reply-To: <4366114E.2060907@speechpro.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--- Igor Robul <igorr@speechpro.com> wrote: > Rob wrote: > >However, the last successful dlopen call does NOT > >clear the earlier dlerror indicator. > > dlerror() resets error indicator. From > /usr/src/libexec/rtld-elf/rtld.c: > > Error indicator is not reset by successful call to > dlopen(), but I'm not sure that dlopen() need reset > error indicator. At least I could not find > information about this in manual page. Noone seems to be sure on what a successful dlopen should do with a previous set dlerror indicator. On some OSes it clears the error (and those people may then assume it should do that in all OSes), whereas it does not so on FreeBSD. Posix may have defined a standard, but I have no access to the Posix guidelines; neither am I interested, since by now my problem with Grace is resolved :). > Is there any standard which describes dl*() > functions? As I said, maybe Posix does ? > Because from _my_ point of view > dlopen()/dlsym() need not clear error indicator on > success, dlopen()/dlsym() need to return NULL on > error. dlopen() indeed returns NULL on error, but dlsym() may return NULL, without experiencing any error; if dlsym() encounters an error, then it will return NULL *AND* sets the dlerror. E.g. this is what you supposed to code: data = dlsym(....); error = dlerror(); if ( !data && error != NULL ) { print_error(error); return FAILURE; } > dlerror() is one who can/have to clear error > indicator. Yes, sure, dlerror() clears previous dlerror indicator. Rob. __________________________________ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051031133921.20253.qmail>