Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am having a library conflict issue with calling an external program from within a interpreted programming environment (IDL). The issue seems to be that since the program I am calling ends up as a child of IDL, libraries are not being reloaded.

From within IDL I can launch sub-processes either directly or using a shell. Is there a good way that I can cause my program to be run without ending up as a child process?

The only solution I have found so far is to use ssh localhost my_program. This works perfectly but I would like a more direct solution.

share|improve this question
    
Actually, could you explain in more detail why and how it should be "not a child process"? –  grawity Oct 20 '11 at 12:02
1  
My specific issue has to do with conflicting versions of a dynamic library on OS X. IDL uses an old version of libcurl.dylib while the a program that I am calling from within IDL requires a newer version of this library. I do not understand how dynamic libraries are handled on OS X, but it appears to me that once the older library is loaded, all child processes use the same library. When running my program in a different terminal, or from within IDL using an ssh connection, I have no library issues. –  amicitas Oct 20 '11 at 12:16
    
Creating a process that is not a child of the current process seems like it should solve my problem. I am now curious in general how to do this. I would have thought this would be a fairly easy thing to do, but can't seem to find a way. So my question is still about starting a process outside the current process tree, rather than a specific solution to my issue. –  amicitas Oct 20 '11 at 12:17
add comment

1 Answer

A different set of dynamic libraries could be loaded by IDE because your application inherits a different environment which is then used by the dynamic linker to find the libs. See dyld manpage for environment variables that could affect the dynamic linker's behavior. Your IDE should have options to control this.

If you still want to ensure your app is run from a process which doesn't have your IDE as ancestor you can configure the IDE to run a command like this:

bash -c 'your_app &'

this will make bash run your_app in the background and exit. When parent process (here: bash) exits, the child (here: your_app) is adopted by the init process, meaning that init (PID=1) becomes its parent. Again however, this will not have an effect on the libraries loaded.

You could also run a server script which waits for a signal (using trap command) and executes your app when it receives it. Your IDE should then be configured to run a kill command to send the signal to the server. This way you will be running your app in the same environment as your terminal. This is probably an overkill solution.

My recommendation is to attempt to configure IDE so that the right libraries are used by the child process.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.