Writing Plug-in Initialization Functions32 Netscape Directory Server Plug-In Programmer’s Guide • May 2002In some cases, you may need to send an LDAP result back to the client. Forexample, if you are writing a pre-operation bind function and an error occursduring the processing of the function, the function should return a non-zero value,log an error message, and send the appropriate LDAP result code back to the client.For information on the appropriate result code to return to the client, refer to thechapter that documents the type of plug-in you are writing.Writing Plug-in Initialization FunctionsBefore the Directory Server can call your plug-in function, the function be mustproperly initialized. To do this, you must write an initialization function for yourserver plug-in. The initialization function should do the following:1. Specify the plug-in compatibility version.2. Register each of your plug-in functions.3. Return a value to the Directory Server.Your initialization function should have a prototype similar to the following:int my_init_function( Slapi_PBlock pb );Notice that in the initialization function, the Directory Server passes a singleargument of type Slapi_PBlock.Initialization Functions for Windows PlatformsIf you are writing an initialization function for a plug-in that runs on Windows NTor Windows 2000, make sure to export the initialization function. For example:__declspec(dllexport) int my_init_function(Slapi_PBlock pb);On top of exporting the initialization function, you must also specify the name ofthe initialization function in a .def file.In addition to the initialization function, you might need to export other functionscontained in your plug-in. In particular, you will need to export any functions thatare not specifically registered by your initialization functions, such as the entrystore and entry fetch plug-in functions that are described in Chapter 9. Registeringplug-in functions is described in detail in the next section, “Registering YourPlug-In Functions.”