Build DSOs or DLLs with IHS: IBM HTTP Server
System Administration IBM HTTP Server documentation
Applies to UNIX Applies to Windows NT

Build Dynamic Shared Object Modules (DSOs) or Dynamic Link Libraries (DLLs) with IHS


Build Apache modules and Third Party modules as Dynamic Shared Object modules (DSOs), or Dynamic Link Libraries (DLLs), for execution with IBM HTTP Server (IHS). Apache modules that are statically linked with Apache at Apache build and install, cannot statically link with IHS. IHS is shipped as an install image with executables that cannot be rebuilt, since the source for IHS is not shipped with the install image. IHS does ship the header files necessary to compile and build a DSO, or DLL that is executable as an IHS module.

  • The IHS executable has a few source code changes from Apache. These changes are mainly hooks to accommodate FRCA, SSL and SNMP.
  • IHS shipped the header files necessary to build Apache Modules (DSOs or DLLs) for execution with IHS.

To assist in building Dynamic Shared Objects (DSOs) or Dynamic Link Libraries (DLLs), the following general information is provided:

Compilers

Our tests with Apache modules or Third Party modules are made using the compilers and compiler level listed above. Other compilers can work, but our testing was limited to these environments.

  • AIX - C & C++ Compiler for AICX V3.6.6
  • Windows NT/2K - Microsoft Visual C++ 6.0
  • Solaris - SunWorkShop 5.0
  • HP - HP_UX aC++ Compiler (A.03.xx)
  • Linux - gcc-2.95.x
Applies to UNIX

Components for Building on UNIX

httpd.exp is found in libexec directory

Header files are found in include directory

APXS script is found in bin directory

Applies to Windows NT

Components for Building on Windows NT

On Windows NT, it is important to use the ApacheCore.lib and Headers files installed with IHS.

ApacheCore.lib is found in src/CoreR directory

Header files are found in src/os/win32 directory

Build Methods

Applies to UNIX Applies to Windows NT
  • Configuration Scripts - Some Apache modules include "configuration scripts" with the module source. These scripts make it easy to compile and install these modules with Apache. These scripts are usually supported by the module writer.

    Sometimes for UNIX, these Configuration scripts have a WITH_APXS option. If you use this option, ensure you point to the APXS script installed with IHS, in the bin directory.

    Other configuration script parameters like -prefix, -sbindir, -includedir, -libexecdir, and -sysconfdir, can default to an Apache directory, rather than an IHS-installed directory. Check these parameters if you are having problems building or run your DSO built module.

  • Example_module directory
    • Windows NT - IHS ships a sample module and project file for building a DLL on Windows NT. The project file is configured to find header files in src\include and resolve references to src\Corer\ApacheCore.lib. See Build Dynamic Modules on Windows
    • UNIX - IHS ships a sample makefile and module in example_module directory. See Related Information, for links to building dynamic modules on specific platforms.
  • APXS Script - (UNIX only)

    APXS is a perl script placed in the IHS bin directory during install. This script builds dynamically shared objects on HP, Solaris, Linux and AIX.

    To use the APXS script, ensure that PERL is installed. The path to the PERL executable is found on the first line of the APXS script, for example,/usr/bin/local/perl. See Related Information, for links to using the APXS script on specific platforms.

Things to Consider

  • If you already have Apache installed in the default directory, /usr/lib/apache, note that configure scripts shipped with Third Party modules, can look for and use parameters based on Apache directories. This situation can cause problems if you are building a Third Party module to run as a DSO or DLL with IHS.

  • The recommended option for building IHS DSOs and DLLs is outside of the Apache tree.

  • Modules which directly access fields in the BUFF structure may not work with IBM HTTP Server. In IBM HTTP Server, the BUFF structure and related socket operations are modified in support of SSL and other functions unique to IBM HTTP Server. Apache modules should avoid accesses to fields in the BUFF structure and instead use ap_r functions, such as ap_rwrite() and ap_rflush(). Note that the core Apache code avoids accesses to BUFF fields and BUFF functions, such as ap_bwrite() ap_bflush(), wherever possible.

    Following is an example of module code which accesses the file and socket descriptor field in the BUFF structure:

      int fd;
      fd = r->connection->client->fd;  /* invalid with IBM HTTP Server */
      shutdown(fd, 1);
    

    Sections of code like this may, or may not result in a compiler warning or error, when using the IHS-supplied header files.

    In very limited circumstances, you can replace direct accesses of the socket descriptor with a call to ap_bfileno(). If the resulting code works with IHS, this code should work with Apache as well. Following is an example call to ap_bfileno():

      int fd;
      fd = ap_bfileno(r->connection->client, B_WR);0">
      shutdown(fd, 1);
    
 
Related information...

     (Back to Top)