After you finish coding the UOC, you must create a dynamic link library. Specify the created dynamic link library and the functions to be called in the control statements for pdload or pdrorg.
The following example uses Microsoft Visual C++ 4.2 to create a dynamic link library:
(a) Creating a module definition file (.def)
- Create a file for exporting the function in DLL that is called from pdload or pdrorg. In this example, the DLL name is sample1.dll and the function name is date_change_func.
sample1.def
EXPORTS
date_change_func
(b) Creating DLL
- From the Microsoft Visual C++ group, start Microsoft Developer Studio and from the File menu, choose New, Project Workspace, then Dynamic-Link Library.
- From the Insert menu, choose Add File to Project, then add the UOC source files (.c) and the module definition file (.def) created in 1.
- To include the UOC creation header file (pdutluoc.h) that declares the UOC interface area and symbolic constants, specify %PDDIR%\include in the include file path. To specify this, choose Build, Settings, C/C++, Preprocessor, then Additional include directories.
- Choose Build and then execute the DLL build. In this case, make sure that both the import library file (.lib) and the export library file (.exp) have also been created.
(c) Notes
- Do not specify the base address of the created DLL (default load address). If it is specified, address contention may occur on a HiRDB or system DLL, resulting in a heavy workload on DLL loading processing.
- For Microsoft Visual C++, use version 4.0 or later.
- Use the _cdecl call conventions for the created DLL. (_cdecl is the default call conventions for C and C++ programming.)
- For the Microsoft Visual C++ run-time library, make sure that the multi-thread DLL version (/MD) is used. Using any other library may result in invalid area management, thereby causing server processes to terminate abnormally.