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.
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to