Replace implementation of linkWithLibrary()
Add missing header file