add optional RTLD flags argument to dlopen, fixes issue #2312