The shl_unload Routine Returning ETXTBSY

When shl_unload returns -1 and sets errno to ETXTBSY, it means the library cannot be unloaded because it is still being used by the program or other shared libraries. This error occurs when a shared library cannot be unloaded for the following reasons:

Another dll (dynamic loading library) loaded by the program has an explicit dependency on the library.

The program has bound a symbol reference to some symbol defined by the library.

Majority of the problems that lead to this error are application-specific. Most applications can ignore this error, unless the applications absolutely depend on a library being unmapped from the process' address space. To ascertain instances of the problem, you can do the following:

Examine the program's dependencies to see if any dll depends on the shared library you are attempting to unload.

Check the program and its shared libraries for symbol references that may have been resolved to a symbol definition in the shared library you are attempting to unload. You can use elfdump for this check.

The shl_unload routine is likely to return ETXTBSY in the non-C++ class of programs. Any non-C++ program that dynamically loads a C++ shared library, will probably get an ETXTBSY error when it attempts to unload that shared library. To correct this problem, build the program using the C++ driver. Non-C++ class of programs are programs that are not linked with the C++ driver and C++ support libraries (shared library linked with the C++ driver or with C++ support libraries).

Dynamic Loader Compatibility Warnings

Starting with the HP-UX 10.20 release, the dynamic loader generates compatibility warnings. These warnings include linker toolset features that may change over time. To display run-time compatibility warnings, set the _HP_DLDOPTS environment variable as follows:

export _HP_DLDOPTS=-warnings Turn on compatibility warnings

The following sections provide information about the dynamic loader compatibility warnings.

Unsupported Shared Library Management Routines

The following shared library management shl_load(3X) routines may become unsupported in a future HP-UX release:

shl_definesym()

shl_get()

shl_get_r()

shl_gethandle()

shl_gethandle_r()

shl_getsymbols()

When these routines become unsupported, the SVR4 dlopen (3C) family of routines will be the only dynamic loading routines supported.

Unsupported Shared Library Management Flags

The following shared library management shl_load(3X) flags may become unsupported in a future HP-UX release:

BIND_FIRST

BIND_NOSTART

Dynamic Loader Compatibility Warnings 183