Home | Previous Page | Next Page   Appendix H. Custom Drivers > Adding a Custom Driver to the onpload Utility >

Rebuilding the Shared-Library File

If you use custom drivers or custom-conversion functions, you must rebuild the ipldd09a.SOLIBSUFFIX shared-library file with your custom-code files. (SOLIBSUFFIX is the shared-library suffix for your operating system.)

After you rebuild ipldd09a.SOLIBSUFFIX, you must install it in the $INFORMIXDIR/lib directory. To store the shared library in a different location, such as /usr/lib, set the HPL_DYNAMIC_LIB_PATH configuration parameter to the appropriate path in the plconfig file.

Important:
For security reasons, you should keep all shared libraries used by the database server in directories under $INFORMIXDIR.
To build the shared-library file
  1. Use the following code as a template to prepare a makefile. You can copy a template for the makefile from the $INFORMIXDIR/incl/hpl directory.
    ########################################################
    # Makefile for building onpload shared library 
    #
    
    LD = ld
    
    # link flag for building dynamic library, may be different
    # for your platform, see the man page for ld, the link
    # editor.
    LDSOFLAGS = -G
    
    # where to find plcstdrv.h
    INCL = $INFORMIXDIR/incl/hpl
    
    # SOLIBSUFFIX is the shared library suffix for your
    # platform. For Solaris it is "so"
    SOLIBSUFFIX = so
    
    PLCDLIBSO = ipldd09a.$(SOLIBSUFFIX)
    
    .c.o:
       $(CC) $(CFLAGS) -I$(INCL) -c $<
    
    #
    # plcstdrv.c contains the custom driver table, required
    # plcstcnv.c contains the custom function table, required
    # your_custom_driver.c contains your custom driver
    #       routines, optional
    # your_custom_conversion.c contains your custom 
    #       conversion functions, optional
    # 
    
    SOOBJS = plcsrdrv.o plcsrcnv.o your_custom_driver.o 
    your_custom_function.o
    
    solib: $(SOOBJS)
       $(LD) -o $(PLCDLIBSO) $(LDSOFLAGS) $(SOOBJS)
    
    ################ end of makefile ######################
  2. Include the following files in the makefile.
    File
    Description
    plcstdrv.c
    Prepares the custom driver tables
    plcstcnv.c
    Prepares the custom-conversion function tables
    your_custom_driver.c
    Contains your user-specific driver functions
    your_custom_functions.c
    Contains your user-specific conversion functions

    Appendix E. Custom-Conversion Functions describes the plcstcnv.c and the your_custom_functions.c files.

  3. Run make using the makefile.

    The makefile builds the shared-library file ipldd09a.SOLIBSUFFIX, where SOLIBSUFFIX is the shared-library suffix for your operating system.

    The HPL uses the same library for both custom-conversion functions and custom drivers, so when you rebuild the library, you must also link the custom-conversion code.

  4. Install the shared library in the appropriate path for your operating system.

    For example, on Solaris you must install the shared library in the $INFORMIXDIR/lib directory, or in the directory specified by the HPLDYNAMICLIB configuration variable in the PLCONFIG file. You can move ipldd09a.SOLIBSUFFIX into the shared-library directory, or you can use a link. For administrative purposes, a link might be clearer.

  5. Set the owner and group of the shared-library files to informix. Set the permission bits to 0755 (octal).
Tip:
When the libraries are updated, the letter before the decimal (here, the letter a) changes to indicate that the library has changed. If you do not find ipldd09a, look for ipldd09b or ipldd09c.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]