[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lt_dlerror() not returning NULL when no error

From: Sebastien Sable
Subject: lt_dlerror() not returning NULL when no error
Date: 15 Jan 2002 20:24:55 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

I have the following code that works (identbrl is not NULL and it
works ok when called) :

  identbrl = lt_dlsym(library, "identbrl");

however if I add the following code :

  identbrl = lt_dlsym(library, "identbrl");
  strerror = lt_dlerror();
  if (strerror)
      Log(LOG_ERR, "%s", strerror);
      return 0;

I get an "unknown error" message.

So lt_dlerror must be returning non-NULL while there is no error. But
its documentation says :

Function: {const char *}lt_dlerror (void)
Return a human readable string describing the most recent error that
occurred from any of libltdl's functions. Return NULL if no errors
have occurred since initialization or since it was last called.

I used lt_dlerror instead of checking if lt_dlsym returns a NULL value
because of a comment in the autobook :

run = (entrypoint *) lt_dlsym (module, "run");

/* In principle, run might legitimately be NULL, so
   I don't use run == NULL as an error indicator
   in general. */
errormsg = dlerrordup (errormsg);
if (errormsg != NULL)
    errors = lt_dlclose (module);
    module = NULL;

So how am I supposed to check if there is an error with lt_dlsym()? by
checking if lt_dlsym() is non-NULL or by checking if lt_dlerror() is
non-NULL or something else?

  identbrl = lt_dlsym(library, "identbrl");
  if (!identbrl)
      strerror = lt_dlerror();
      Log(LOG_ERR, "Driver symbol not found identbrl : %s", strerror);
      return 0;

thanks in advance

Sébastien Sablé <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]