Ray Mack(deleted)
|
dlopen fails but not a helpful dlerror response
|
Ray Mack(deleted)
07/14/2015 11:14 AM
post114119
|
dlopen fails but not a helpful dlerror response
Any ideas how to get a useful error message from the dynamic library loading facility? I have an issue where the
debugger is loading my library into /opt/target and my code is calling dlopen with the correct name. I get NULL back
from the call and the error string from dlerror() is "(Shared objects still referenced)"
As you can see, it is not terribly useful in figuring out what the OS thought was wrong. I have verified that the
permissions are correct (777) and the name is spelled correctly so it is not permissions or a bad name.
With fopen() you get an error such as E_EXIST or other useful detailed information.
Here is the offending code:
void *Library=dlopen(Path.c_str(), RTLD_NOW | RTLD_NODELETE);
if ( Library==NULL )
{
char *ErrorStr=dlerror();
printf( "%s::%s(): ERROR - failed to load '%s' (%s)\n",
CLASS_NAME, __FUNCTION__, Path.c_str(), ErrorStr);
}
And here is the output:
IComponent::RegisterDynamic(): ERROR - failed to load '/opt/target/libModbusTransceiver_g.so' (Shared objects still
referenced)
Any hints on how to find the real error are appreciated. My guess is that there is some error with the format of the
library since the file exists and the name in the call matches the name on disk.
Ray
|
|
|