Build as shared library

Sorry I didn't make those changes before previous pull request.