debug dlopen returning NULL

Hi,

For the very same plugin dlopen() sometimes fails. The library is present but sometimes it returns NULL and sometimes a valid plugin handle.

Here is the code:

char *filename;
void *plugin_so;

filename = "/Applications/com.example.MyApp/Contents/Plugins/myplugin.dylib";

plugin_so = dlopen(filename,
		               RTLD_NOW);

I have debugged using lldb checked filename and it is present.

The myplugin.dylib file supports 2 architectures, arm64 and x86_64.

regards, Joël

Accepted Answer

man dyld and check for debugging environment variables to turn on diagnostics. Check for failed initializers helped me.

Actually 2 libraries the plugin was using were not found.

problem fixed.

by, Joël

debug dlopen returning NULL
 
 
Q