HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
/* If a problem occurs, log an error message, return -1.*/
slapi_log_error(SLAPI_LOG_PLUGIN, "searchdn_preop_init" ,
"Error registeringfunction.\n" ); return( -1 );
}
/* If the plug-in was successfully registered, log a
* message and return 0. */
slapi_log_error( SLAPI_LOG_PLUGIN, "searchdn_preop_init" ,
"Plug-in successfully registered.\n" ); return( 0 );
}
2.3 Compiling a Directory Server plug-in
Keep in mind the following tips when compiling the server plug-in:
You need to compile and link the code as a shared object or library.
Ensure that the /opt/dirsrv/devel/include directory is in the include path.
If you prefer, you can compile all plug-in functions in a single library. Although you can
include different types of plug-in functions in the same library, you need to write separate
initialization functions for each type of plug-in function. Refer to Chapter 3 “Configuring
plug-ins” for details on how to specify each initialization function in a directive for a specific
type of plug-in.
The following code shows a sample Makefile.
NOTE:
This example uses the +DD64 compiler option because HP-UX Directory Server is a 64-bit
application. Any plug-ins that you load into HP-UX Directory Server must be built in 64-bit
mode.
# Makefile for Directory Server plug-in examples
#
CC = cc
LD = ld
CFLAGS=-I/opt/dirsrv/devel/include -D_HPUX_SOURCE -Ae +z +DD64
LDFLAGS = +k -b +s $(EXTRA_LIBS)
OBJS = testsaslbind.o testpreop.o testpostop.o testextendedop.o testentry.o test
bind.o testgetip.o testdatainterop.o testdbinterop.o
all: libtest-plugin.so
libtest-plugin.so: $(OBJS)
$(LD) $(LDFLAGS) -o $@ $(OBJS)
.c.o:
$(CC) $(CFLAGS) -c $<
clean:
-rm -f $(OBJS) libtest-plugin.so
36 Writing and compiling plug-ins