Add dlerror() to DynamicLibrary::open


#1

I had some troubles loading a dylib on osx.
So i added a dlerror() call to DynamicLibrary::open to be able to spot the issue better. Might be a good thing to add.
 

bool DynamicLibrary::open (const String& name)

{

    close();

    handle = dlopen (name.isEmpty() ? nullptr : name.toUTF8().getAddress(), RTLD_LOCAL | RTLD_NOW);

const char* error = dlerror();

if (error != nullptr)

    {

        DBG(error);

        jassertfalse;

    }

    return handle != nullptr;

}

 


#2

Or maybe better, a method to get the last error.  String getLastError();
 


#3

Yes, good idea!

(actually what we should do is to replace the bool return type with a Result object)