Configuring and Managing MPE/iX Internet Services (July 2001)
Chapter 9 179
Apache for MPE/iX
Major Components
shown in the section “Modified APXS Makefile (mod_hw)”. The modified
Makefile still calls apxs for getting the correct compile options and
include files but does not use apxs for compiling and linking.
Makefile can easily be modified for customization. For the sample
module, mod_hw, the additional source file, hw.c, was added to
Makefile. Using a Makefile is a convenient and flexible way to build
modules.
Here is the output from executing mod_hw’s modified apxs Makefile:
shell/iX> cd /APACHER/PUB/hw
shell/iX> make
gcc -o mod_hw.o `/APACHE/PUB/bin/apxs -q CFLAGS` -I`/APACHE/PUB/bin/apxs -q
INCLUDEDIR` -c mod_hw.c
gcc -o hw.o `/APACHE/PUB/bin/apxs -q CFLAGS` -I`/APACHE/PUB/bin/apxs -q
INCLUDEDIR` -c hw.c
callci "linkedit 'buildxl xl=./mod_hw.so;limit=5'"
HP Link Editor/iX (HP30315A.06.15) Copyright Hewlett-Packard Co 1986
LinkEd> buildxl xl=./mod_hw.so;limit=5
LinkEd> addxl from=./mod_hw.o,./hw.o;to=./mod_hw.so;
rl=/lib/libm.a,/lib/libc.a
;merge;share
1 OBJECT FILE HAS BEEN ADDED.
Linking Libraries into a DSO
When a DSO requires external library functions, as does mod_hw,
these can be resolved using either archive libraries or shared libraries.
With archive libraries, external calls are resolved at link time and the
functions are incorporated into your DSO. With shared libraries,
external calls are resolved at run time. At run time, the loader searches
the shared libraries for these external functions.
This section discusses the linking of a module. Linking is independent
of the method used to create and compile the module code.
Archive libraries
Archive libraries may be either custom archive libraries (built by
others) or system archive libraries. System archive libraries are “.a”
files residing in /lib and /usr/lib.
The following shows how to build hw.c as an archive library then link it
into mod_hw.so:
shell/iX> cd /APACHE/PUB/hw
shell/iX> gcc -c -DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE -DNO_DBM_REWRITEMAP
-DUSE_HSREGEX -DEAPI -DSHARED_MODULE -I/APACHE/PUB/include hw.c
shell/iX> ar -rv hw.a hw.o
ar: creating hw.a