From owner-freebsd-questions@FreeBSD.ORG Thu Oct 27 08:20:05 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 D0F8C16A41F for ; Thu, 27 Oct 2005 08:20:05 +0000 (GMT) (envelope-from igorr@speechpro.com) Received: from speechpro.com (speech-tech-2.ip.PeterStar.net [81.3.190.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id 83C4143D70 for ; Thu, 27 Oct 2005 08:20:01 +0000 (GMT) (envelope-from igorr@speechpro.com) Received: from sysadm.stc ([192.168.2.26]) by s1.stc with esmtp (Exim 4.53 (FreeBSD)) id 1EV2zN-000LoD-VJ; Thu, 27 Oct 2005 12:19:58 +0400 Message-ID: <43608D9F.9020207@speechpro.com> Date: Thu, 27 Oct 2005 12:19:43 +0400 From: Igor Robul User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051018) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Rob , freebsd-questions@freebsd.org References: <20051027080228.60100.qmail@web36212.mail.mud.yahoo.com> In-Reply-To: <20051027080228.60100.qmail@web36212.mail.mud.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Archived: Yes Cc: Subject: Re: math/grace port: "libXcursor.so.1.0" not found ?? [SOLVED] 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: Thu, 27 Oct 2005 08:20:05 -0000 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.