From owner-freebsd-questions@FreeBSD.ORG Mon Oct 31 13:39:23 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0EDBE16A41F for ; Mon, 31 Oct 2005 13:39:23 +0000 (GMT) (envelope-from spamrefuse@yahoo.com) Received: from web36209.mail.mud.yahoo.com (web36209.mail.mud.yahoo.com [209.191.68.235]) by mx1.FreeBSD.org (Postfix) with SMTP id A1F3343D49 for ; Mon, 31 Oct 2005 13:39:22 +0000 (GMT) (envelope-from spamrefuse@yahoo.com) Received: (qmail 20255 invoked by uid 60001); 31 Oct 2005 13:39:21 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=xQ3bnrZarrOsvXCvQvhXzfndeJCz2UyoNpIhDCaEsxqqy1ZZ4d2cNFLg4HWaRco7Qx/s2Co9qltZDW47s48I5CywGJby69azuJhE507t451JkRUI/aXb498T6V1MBftnwWn7HfRxaDN5CCV1OnAO4aJ+80uVfUJcd+0GFxLIr+Y= ; Message-ID: <20051031133921.20253.qmail@web36209.mail.mud.yahoo.com> Received: from [218.232.14.39] by web36209.mail.mud.yahoo.com via HTTP; Mon, 31 Oct 2005 05:39:21 PST Date: Mon, 31 Oct 2005 05:39:21 -0800 (PST) From: Rob To: Igor Robul , freebsd-questions@freebsd.org In-Reply-To: <4366114E.2060907@speechpro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: Subject: Re: dlopen()/dlsym()/dlerror() was: Re: libXcursor.so.1.0.2 reference in libX11.so.6 ?? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2005 13:39:23 -0000 --- Igor Robul 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