On Thu 31 Mar 2011 16:32, l...@gnu.org (Ludovic Courtès) writes: > Hello, > > Mike Gran <spk...@yahoo.com> writes: > >> + const char *lt_err = lt_dlerror (); >> + if (lt_err == (const char *) NULL || strncmp (lt_err, "No Error", >> strlen ("No Error"))) >> + { >> + char *msg; >> + int ret; >> + ret = asprintf (&msg, "symbol \"%s\" not found", symb); >> + if (ret != -1) >> + { >> + scm_misc_error (subr, msg, SCM_EOL); >> + free (msg); >> + } >> + else >> + scm_misc_error (subr, "symbol not found", SCM_EOL); >> + } >> + else >> + scm_misc_error (subr, (char *) lt_dlerror (), SCM_EOL); > > Two things: > > 1. the bottom-most ‘scm_misc_error’ call should use ‘lt_err’. > > 2. ‘asprintf’ is a GNU extension so can’t be used here (unless we use > the right Gnulib module.)
There were more things: no need to asprintf, as you could just pass a format string to scm_misc_error; and it's not actually an error to get NULL from lt_dlsym, so you shouldn't call lt_dlerror there. Andy -- http://wingolog.org/