Date: Thu, 27 Oct 2005 12:26:45 +0400 From: Igor Robul <igorr@speechpro.com> To: freebsd-questions@freebsd.org Subject: Re: math/grace port: "libXcursor.so.1.0" not found ?? [SOLVED] Message-ID: <43608F45.2080600@speechpro.com> In-Reply-To: <43608D9F.9020207@speechpro.com> References: <20051027080228.60100.qmail@web36212.mail.mud.yahoo.com> <43608D9F.9020207@speechpro.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Igor Robul wrote:
> 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);
>
Actual code in grace is:
 newkey.data = dlsym(handle, dl_function);
    if ((error = (char *) dlerror()) != NULL) {
        errmsg(error);
        dlclose(handle);
        return RETURN_FAILURE;
    }
But I think it is needed to be something like (I dont know if they need 
"error" variable later):
newkey.data = dlsym(handle, dl_function);
    if (  newkey.data == NULL) {
        errmsg(error=dlerror());
        dlclose(handle);
        return RETURN_FAILURE;
    }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43608F45.2080600>
