Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
C/MATLAB API interface settings affects other applications in OS X
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm calling MATLAB from my c++ code via the MATLAB Engine API library on a Mac. I learned that I need to set the environment variable:
export PATH='/Applications/MATLAB_R2015a.app/bin:$PATH'
export DYLD_LIBRARY_PATH='/Applications/MATLAB_R2015a.app/bin/maci64:/Applications/MATLAB_R2015a.app/sys/os/maci64:$DYLD_LIBRARY_PATH'
then I was able to setup the Matlab engine running. However I realised the setting of those environment variables have other effects: within the shell, curl stops working. What's worse is that some multi-threaded codes compiled by openmp stop working as well. I hope to learn an alternative way of setting the environment for Matlab API, without disrupting other applications.
0 commentaires
Réponses (1)
Walter Roberson
le 30 Sep 2015
In POSIX (and OS-X is POSIX certified), you can fork a process, set the environment variables in the process, and exec a new executable, which will have the modified environment variables. This is the procedure that is used by the shell itself.
Once you have a MATLAB process, if you have code called from it that needs different libraries, then you can setenv() within MATLAB before calling upon those routines with system(), or you can have the string you system() be one that sets the environment variables as needed for what you are calling upon.
0 commentaires
Cette question est clôturée.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!