How can I debug shared library problems with NSAPI?

NSAPI applications are provided as shared libraries which are loadedin to the NSAPI runner process at initialization. Problems can arise if the NSAPI runner cannot resolve all the undefined symbols in theshared library.

On startup, the NSAPI runner first loads the shared library ZEUSHOME/web/bin/nsapisym.so. It then processes its obj.conf file and loads libraries as instructed by the "load-modules" directive.

   Init fn="load-modules" shlib="/usr/local/libs/foo.so" funcs="foo,bar,baz"

Libraries are loaded using the dlopen system call, with flags'RTLD_LAZY|RTLD_GLOBAL'. (HP-UX usesshl_load( BIND_DEFERRED|BIND_VERBOSE )).

Any symbols (listed in the optional 'funcs' tag) are thenloaded using dlsym (orshl_findsym( TYPE_PROCEDURE ) on HP-UX).

Because the funcs tag is optional, you can use the load-modules directive to modify your linkage environment byforcing a dlopen of extra libraries. This can resolve problemswhere an NSAPI application has a dependency on another shared library thatis not automatically loaded in the NSAPI runner.

Versions of Zeus built after October 1st 1999 provide both the standard C and C++ library symbols in their linkage environment.

They also support a command line '-dlopen' flag to help debug shared library loading problems:

   $ZEUSHOME/web/bin/zeus.nsapi -dlopen $ZEUSHOME/web/bin/nsapisym.so /lib/libfoo.so /lib/libbar.so

will cause zeus.nsapi to load the shared libraries listed in the command line, report any link errors (or otherwise), and then exit.

From Zeus 4.1 onwards, you can also execute:

   $ZEUSHOME/web/bin/zeus.nsapi -dlopen=<library.so>:<symbol>[,symbol][,...]

With an arbitrary number of libraries (by using sperate dlopen parameters) followed by any number of comma-seperated symbols, to check for symbols in shared objects.

Content Manager [Administrator] 19 September 2005  Permalink  
Download Free Trial

Recent Articles

Other Resources



www.zeus.com