OpenTP1 Version 7 User's Guide

[Contents][Index][Back][Next]

3.5 Handling of UAP shared libraries when using dynamic loading of service functions

This section discusses the handling of UAP shared libraries when dynamic loading of service functions is used. For an overview of dynamic loading of service functions, see the OpenTP1 series manuals.

Dynamic loading of service functions cannot be used in the following cases:

Organization of this section
(1) Exporting UAP shared libraries
(2) Handling of the library search path
(3) Replacing the service functions of user service processes
(4) Specifying the UAP shared library name
(5) Notes about UAP shared libraries when using dynamic loading of service functions

(1) Exporting UAP shared libraries

If service functions are in a UAP shared library, make sure that you export from the UAP shared library the service functions defined in the user service definition that are included in the UAP shared library when the user server starts.

If the service functions have not been exported (during process startup for a nonresident server), the following occurs:

For SPP
The KFCA00344-E message is output and then the dc_rpc_mainloop function returns with error DCRPCER_FATAL(-303).

For MHP
The KFCA00344-E message is output and then the dc_mcf_mainloop function returns with error DCMCFER_FATAL(-11902).

You can export any function other than the service functions specified in the user service definition according to the processing mode because export of such a function is not mandatory.

You can use the lib and link commands to export functions from a UAP shared library. Use one of the following methods to export service functions:

For examples of creation, see the following sample source (makefiles):

SPP development language and environment Makefile name
C language
%DCDIR%\examples\base\aplib\c\make_svdl
COBOL COBOL2002
%DCDIR%\examples\base\aplib\cobol\make_svdl
Net Express
%DCDIR%\examples\base\aplib\cobol\makemf_svdl

(2) Handling of the library search path

If only a UAP shared library name is specified, OpenTP1 searches for the specified UAP shared library based on the OS library search path. In Windows, the specified UAP shared library is searched for using the search paths listed below (where the search paths are listed in order of priority):

#1
This is a temporary folder managed by OpenTP1. Do not store a created UAP shared library in this folder because this folder is deleted when the OpenTP1 system or UAP starts.

#2
We strongly recommend that you do not store a created UAP shared library in a Windows system folder or a Windows folder, so make sure that you avoid storing created UAP shared libraries in these folders.

The following example loads the into the UAP the UAP shared library located under folder (b):

Name of path containing UAP: c:\user\aplib\user.exe
Name of path containing DLL: c:\opentp1\aplib\libusr.dll
c:\user\aplib\libusr.dll
<Process service definition>
prcsvpath c:\opentp1\aplib; c:\user\aplib
(a) (b)

(3) Replacing the service functions of user service processes

When you are using dynamic loading of service functions, you can replace a user server's service functions without having to stop online operation. This subsection explains how to replace service functions and how to check the result.

(a) Replacing service functions

This subsection explains how to replace service functions when you change the user service definition and when you change the UAP shared library search path.

When you change the user service definition:
  1. Use the dcsvstop command to terminate the applicable user server.
  2. Change the service operand specification in the user service definition for the user server.
  3. Use the dcsvstart command to start the user server.

When you change the UAP shared library search path:
  1. Use the dcsvstop command to terminate the applicable user server.
  2. Place a UAP shared library in a new UAP shared library storage folder.
  3. Use the prcpath command to change the UAP shared library search path to the new UAP shared library storage folder.
  4. Use the dcsvstart command to start the user server.
(b) Checking the result after replacing a service function

Check the start time of the new executable file and compare it to the execution time of the dcsvstart or scdrsprc command.

You can use the procedure described below to check the start time of the new executable file. The example provided here is for Windows Server 2008.

To check the result:

  1. From the Start menu, choose Run.
  2. In Open, enter Msinfo32.exe and then click OK. The System Information dialog box opens.
  3. In the left-hand pane of the System Information dialog box, click Software Environment, and then Running Tasks.
  4. From the files displayed in the right-hand pane, find the executable file and check its start time.

(4) Specifying the UAP shared library name

You can specify both an absolute path and a library name in the service operand in the user service definition.

If the UAP shared library specified by the absolute path is the same as that specified by the library name, the UAP shared library path to be loaded depends on the specification order.

The following provides the details based on which name is specified first.

If the first UAP shared library name specified is a library name:
The UAP shared libraries with the specified library name are searched for in the library path according to the search order of paths specified for the library name. As a result, the UAP shared library under the first folder found is loaded.
Next, the UAP shared library specified by the absolute path is loaded.
In this specification order, two different UAP shared libraries are loaded into the UAP.
If the UAP shared library storage folder specified by the absolute path is searched first, the same UAP shared library is loaded twice.

If the first UAP shared library name specified is an absolute path:
At first, the UAP shared library specified by the absolute path is loaded. Next, an attempt is made to load the UAP shared library specified as the library. However, the UAP shared library specified by the absolute path is loaded again because the UAP shared library with the same name has already been loaded by using the absolute path specification. In this specification order, the UAP shared library specified by the absolute path is loaded twice into the UAP.

(5) Notes about UAP shared libraries when using dynamic loading of service functions

Do not use a thread local storage (TLS) to declare variables in a UAP shared library specified in the service operand in the user service definition. If the UAP shared library contains a UAP object that contains the code shown below, referencing of the corresponding variable results in an access exception:

__declspec(Thread) int sample;