Make sure lib is a CDLL object.