Debugging dylib with non-unique name

Hi everyone,


I'm trying to debug a plugin for a commerical multi plattform application using XCode and am running into a unexpected problem. The plugin architecture of the application (X-Plane) expects all plugins (which are dylibs under OS X) to have the name "mac.xpl" in the plugins folder. So I set up my XCode project to create a "mac.xpl" file instead of "<project>.dylib" and added a custom build step to copy the file to the plugins directory. Building the plugin and running it with the application alone works as expected. However, when I configure XCode to launch the application to debug my project, every "mac.xpl" file of every installed plugin gets replaced by the "mac.xpl" file of my plugin which then crashes my plugin because it's loaded to early (there are different types of plugins that get loaded at different stages of the simulation).


I've searched and searched but couldn't find anything at all regarding this behavior.


Best regards,

Florian

Replies

Xcode is probably setting a DYLD_… environment variable to force the app to load the development version of your library rather than the installed version. Or something like that. You could try dumping the environment early in your code or running with DYLD_PRINT_ENV=1 added to the environment.


Can you perhaps run the app and attach Xcode's debugger to the running process after it has loaded the other libraries but before it has loaded yours? Or, even if it has already loaded yours, maybe you can attach before the point where you need to debug.

Thank you for the suggestions. With DYLD_PRINT_ENV I found quite a few environment variables that could be the culprit... I'll have to investigate further.

Many thanks,

Florian