If I load a library with relative path, e.g ./sample-library.so, the checkloaded function fails.
In the source code you're looking for the relative path,
if(checkloaded(target, libname))
Why not look for canonical path? The following code fixes the problem:
if(checkloaded(target, libPath))