Some changes for loading the lib dynamically under Windows

See the first commit for the changes in detail.