Mercurial > hg > octave-terminal
changeset 1665:f2f93a3cd42f
[project @ 1995-12-24 07:15:10 by jwe]
author | jwe |
---|---|
date | Sun, 24 Dec 1995 07:15:29 +0000 |
parents | 913a157f1e02 |
children | 90ee76b9fabe |
files | src/dynamic-ld.cc |
diffstat | 1 files changed, 17 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dynamic-ld.cc +++ b/src/dynamic-ld.cc @@ -89,6 +89,8 @@ static void * dl_resolve_octave_reference (const char *name, const char *file) { + void *retval = 0; + // Dynamic linking with dlopen/dlsym doesn't require specification // of the libraries at runtime. Instead, they are specified when // the .oct file is created. @@ -97,11 +99,9 @@ if (handle) { - void *func = dlsym (handle, name); + retval = dlsym (handle, name); - if (func) - return func; - else + if (! retval) { const char *errmsg = dlerror (); @@ -111,14 +111,12 @@ error("unable to link function `%s'", name); dlclose (handle); - return 0; } } else - { - error ("%s: %s `%s'", dlerror (), file, name); - return 0; - } + error ("%s: %s `%s'", dlerror (), file, name); + + return retval; } #elif defined (WITH_SHL) @@ -126,6 +124,8 @@ static void * shl_resolve_octave_reference (const char *name, const char *file) { + void *retval = 0; + // Dynamic linking with shl_load/shl_findsym doesn't require // specification of the libraries at runtime. Instead, they are // specified when the .oct file is created. @@ -134,10 +134,8 @@ if (handle) { - void *func = 0; - int status = shl_findsym ((shl_t *) &handle, name, - TYPE_UNDEFINED, func); + TYPE_UNDEFINED, retval); if (status < 0) { @@ -148,16 +146,13 @@ else error("unable to link function `%s'", name); - return 0; + retval = 0; } - else - return func; } else - { - error ("%s: %s `%s'", strerror (errno), file, name); - return 0; - } + error ("%s: %s `%s'", strerror (errno), file, name); + + return retval; } #elif defined (WITH_DLD) @@ -301,15 +296,15 @@ { #if defined (WITH_DL) - dl_resolve_octave_reference (name, file); + return dl_resolve_octave_reference (name, file); #elif defined (WITH_SHL) - shl_resolve_octave_reference (name, file); + return shl_resolve_octave_reference (name, file); #elif defined (WITH_DLD) - dld_resolve_octave_reference (name, file); + return dld_resolve_octave_reference (name, file); #endif }