DLL Programmer's Guide for TNS/R Systems
Dynamic Use of DLLs
DLL Programmer’s Guide for TNS/R Systems—522203-002
3-8
Thread Considerations
process creation errors. These error and error-detail codes are described in the 
Guardian Procedure Errors and Messages Manual and in the PROCESS_LAUNCH_ 
description in the Guardian Procedure Calls Reference Manual.
Certain errors are unique to the dynamic loading functions. These are reported with 
error code 100; the error-detail is one of the following:
1 - An invalid handle argument was passed to dlsym() or dlclose().
2 - The symbol sought by dlsym() was not found.
3 - An unrecognized option was passed to dlopen().
4 - A bounds error occurred on the pathname parameter to dlopen().
5 - 7 An inconsistent state was detected in dlopen() or dlclose() processing. Perhaps a 
process flag at the high-address end of the stack is corrupted.
8 - RTLD_NOLOAD was specified as an option to dlopen(), but the specified library 
was not already loaded.
Calling dlresultcode() does not reset the error code. dlerror() and dlresultcode() can be 
called in either order; neither affects the value returned by the other.
dlresultcode() is an HP NonStop Kernel addition to the conventional set of dynamic 
loading functions.
Thread Considerations
The loader is not aware of threads that may be used in a multi-threaded application. 
Therefore, if you create such an application, you must ensure that no thread switch 
occurs between a dynamic library call and the invocation of dlerror or dlresultcode that 
retrieves information about that call. Since NSK supports only user-level threads, this 
means that during this interval, you must avoid invoking functions that can cause 
explicit thread switching.
Using Dynamically Loaded DLLs to Extend an 
Application
You can take advantage of dynamically loaded DLLs to build your application to 
incorporate anticipated but as yet undefined functions. There are several ways to 
accomplish this. For example:
•
If the application is interactive or has an interactive control mechanism, the 
operator can supply the name of a DLL to load.
•
In a transaction processing system, individual transaction requests could name a 
DLL to process the transaction, or include a transaction type code that maps into 
table of DLL file names; the program might update that table dynamically at 
operator command.










