Is a prototype for startup code for a UNIX style library.
#include <unistd.h> int _init ( void );
If successful in initializing your library, _init should return 0. Any other value should indicate failure.
The _init function should allocate and initialize any data structures or resources that your library needs to do its work. If you write an _init function for initialization, you should also write a _fini function to prepare your library for unloading.
LibC supports four methods for initializing a library; they should not be mixed. For more information, see Section 12.2, Available Approaches for Writing a Library.
Don’t write an _init function if your library is also using a DllMain function.
static int initted = FALSE; // a little protection--probably unnecessary
int _init( void )
{
int err;
if (initted)
return 0;
gModuleHandle = getnlmhandle();
if (err=pthread_key_create(&gKey, (void (*)(void *))
DisposeThrData))
return err;
initted = TRUE;
return 0;
}