You probably want to use the default entry point functions.
In windows, you can use DllMain to create and destroy your mutexes.
On Linux, and possibly some other Unix applications, you can use __attribute__((constructor)) and __attribute__((destructor)) for your entry and exit functions.
In both cases, the functions will be called once during loading and unloading.
doron
source share