Implement library initialization, deinitialization and various stuff