Download pSOSystem Programmer`s Reference

Transcript
pr.book Page 85 Thursday, January 28, 1999 9:18 AM
pSOSystem Programmer’s Reference
System Services
break;
case SL_DETACHEV:
/* Do per process cleanup */
break;
}
return 0;
}
The entry function is called with its event parameter set to the reason for which it
is being called, so that the library can perform the appropriate system or per process initialization and cleanups. When a shared library is registered, pLM+ will call
the entry function with SL_REGEV as the event parameter. When the library is unregistered pLM+ will call the entry function with SL_UNREGEV as the event parameter. This allows the shared library to perform system initialization and cleanup, if
necessary. The entry function is called in the context of the process that is registering or unregistering the library.
Similarly, when a process attaches to the library by calling sl_acquire(), pLM+
will call the entry function with SL_ATTACHEV as the event parameter. When the
process detaches from the library by calling sl_release(), pLM+ will call the entry function with SL_DETACHEV as the event parameter. The entry function is called
in the context of the process that is attaching to or detaching from the library. This
allows the shared library to perform per process initialization and cleanup, if necessary. Since acquiring and releasing libraries may also result in registering and unregistering them, their entry functions are also called with SL_REGEV and
SL_UNREGEV event parameters respectively, when that happens.
The index parameter represents the library index assigned by pLM+. This may be
used by the library to identify itself. It should not be used within the entry function
during SL_REGEV and SL_UNREGEV events. The entry function returns 0 on success
and a nonzero value on failure. If a nonzero value is returned, registration and process attach will fail. Process detach and unregistration ignore the return value but
they do report an information code, denoting that the entry function returned a
nonzero value.
The specifications of library definition file and the shlib template file are explained
next.
pLM+
1-85
1