Automatically executed functions when loading shared libraries
问题 When loading shared libraries in Windows, LoadLibrary() call causes DllMain in library to execute for each new process and thread library attaches to, and for each process and thread library deattaches from. Is there similar mechanism for Mac OS X, Linux and possibly other POSIX-compatible OSs? 回答1: You can define an on-load function for a linux library using the .init mechanism. This is the same as specifying the load-time entry point for a binary (e.g. using something other than main as the