An example of how to use UDF's with the SCO version of InterBase 5.5 for SCO OpenServer

By: Borland Staff

Abstract: In order to use UDF libraries with the InterBase 5.5 version for SCO OpenServer several
steps are required. Some of the issues are not obvious.

In order to use UDF libraries with the InterBase 5.5 version for SCO OpenServer several
steps are required.   Some of the issues are not obvious.

*InterBase 5.5 for SCO OpenServer 5.0.4

I am assuming that InterBase 5.5 for SCO OpenServer 5.0.4 has been installed and licensed as
part of this example.  The files udflib.c, ib_udf.sql, makefile, and employee.gdb  are all found
in the /usr/interbase/examples directory once InterBase 5.5 is installed.   The file gds_inet_server
is found in /usr/interbase/bin.    All of the commands issued in this example were issued from the
/usr/interbase/examples directory  as the user  root.

1.  The only   compiler supported with InterBase 5.5 for SCO OpenServer 5.0.4 is the gcc compiler
      found on the SCO Skunkware98 CD.  You should install this version of gcc (this
       software can be obtained from SCO either at their web site ( or by
       ordering the CD).

       The files from the gcc are located in /usr/local/bin after gcc is installed.  It is recommended that
       you change your PATH environment variable to include  /usr/interbase/bin  and /usr/local/bin
       before you continue.  We will assume that these are set as part of the PATH for the rest of this

2.  For this example,  the  make  utility is used.  No   make  utility is supplied with the SCO
     OpenServer 5.0.X operating system.  It is possible to download and build a copy of
     gcmake from the internet, or to buy a copy of either the SCO OpenServer Development
     system, or the SCO Universal Developement Kit (UDK) from SCO.

     It is also possible to perform the same tasks that  make   performs with shell scripts or manually
     if you do not choose to use  some version of   make .  

    In the example, I use the  make  utility from the SCO OpenServer 5.0.4 Developement System.

3. Create your UDF library in C or C++ using gcc as your compiler.  An example of a UDF library
    is found in /usr/interbase/examples  with the name  udflib.c .  A make file with the name
    makefile  is found in the same directory.     These are good examples to use in creating your
    own UDF libraries.

    In this example,  I use the command    make udflib    to create the library executable.

4.  The external functions you create in your library have to be declared within the database you intend
      to use them in.  An example of an sql script  used to do this declaration is found in
      /usr/interbase/examples.   The file name is  ib_udf.sql.   This particular sql script
      declares the functions created in the udflib  UDF  library.

      For this example, I declared the external functions is the employee.gdb  database.

      To declare the functions,   I executed the command     isql -i ib_udf.sql  employee.gdb 

5.  In order for the InterBase server to find your UDF library when external functions are called,
      the environment variable  LD_LIBRARY_PATH  must be set to include the path to the 
      location of your  UDF library  (in this case   /usr/interbase/examples);

      If running locally, you can set your environment variable to
      the location of the UDF library (in my case, I set

     If running remotely, you will have to:

        a. rename the binary gds_inet_server to another name
            (in my case I renamed it to ib_server.
        b. create a shell script with the name gds_inet_server in the
            /usr/interbase/bin directory  which sets LD_LIBRARY_PATH
             and then calls the renamed binary.

        My shell script reads:

         export LD_LIBRARY_PATH

        c. The mode of the shell script must be set to be
             executable.  (chmod +x /usr/interbase/bin/gds_inet_server)

I then tested using the following test:

1. /usr/interbase/bin/isql
2. connect /usr/interbase/employee.gdb;
3. select lower(country) from country;

This should return a set of countries in lower case.

Server Response from: ETNASC04