unit-tests: Uninline dlopen() and friends, make more dynamic, fix dlerror()