Date: Thu, 27 Oct 2005 12:19:43 +0400 From: Igor Robul <igorr@speechpro.com> To: Rob <spamrefuse@yahoo.com>, freebsd-questions@freebsd.org Subject: Re: math/grace port: "libXcursor.so.1.0" not found ?? [SOLVED] Message-ID: <43608D9F.9020207@speechpro.com> In-Reply-To: <20051027080228.60100.qmail@web36212.mail.mud.yahoo.com> References: <20051027080228.60100.qmail@web36212.mail.mud.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Rob wrote: >----------------------------------- > XtAppContext app_con; > Display *disp = NULL; > char *display_name = NULL; > > XtSetLanguageProc(NULL, NULL, NULL); > XtToolkitInitialize(); > app_con = XtCreateApplicationContext(); > > disp = XOpenDisplay(display_name); >----------------------------------- > >(I have simplified this code snippet a bit, for >this example; also, grace uses Motif for its GUI). > >Before the XOpenDisplay() call, dlerror() does >not have the error-indicator set, but after >that call, it has. > >Is this where Linux and FreeBSD are out-of-sync? >Or does Grace something wrong here, or is this >a problem cause by FreeBSD or Xorg? > > > I think, that when XOpenDisplay called, ld.so tries load some libraries from preconfigured paths, and last unsuccessful attempt is recorded for dlerror(). dlopen() _does not_ reset dlerror() state on sucess, it just returns non NULL. So you must not check dlerror() for error condition, you need check return result of dlopen(), and if it is NULL, then you need use dlerror(). So, code in grace: dlopen("library name", MODE); if (dlerror() != NULL) { report_error(); exit(1); } need to be: handle = dlopen("library name", MODE); if (handle == NULL) { report_error(dlerror()); exit(1); } just because dlerror() != NULL is not indicator of error.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43608D9F.9020207>