Boost C++ Libraries: Ticket #10644: BOOST_IPC_SHARED_DIR env variable to be used for get_shared_dir() https://svn.boost.org/trac10/ticket/10644 <p> Hi, </p> <p> Will it be possible to have shared_dir not hardcoded? Currently it is determine by some tricks (some involve event log parsing on windows, which fails a lot). The only practical solution for us was to use BOOST_INTERPROCESS_SHARED_DIR_PATH define. </p> <p> boost/interprocess/detail/shared_dir_helpers.hpp </p> <p> inline void get_shared_dir(std::string &amp;shared_dir) { </p> <blockquote> <p> #if defined(BOOST_INTERPROCESS_SHARED_DIR_PATH) </p> <blockquote> <p> shared_dir = BOOST_INTERPROCESS_SHARED_DIR_PATH; </p> </blockquote> <p> #else </p> <blockquote> <p> get_shared_dir_root(shared_dir); #if defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) </p> <blockquote> <p> shared_dir += "/"; get_bootstamp(shared_dir, true); </p> </blockquote> <p> #endif </p> </blockquote> <p> #endif </p> </blockquote> <p> } </p> <p> That has limitations tough as it makes it very difficult to test software in isolation (it requires access to the same folder). Similarly it makes is difficult to run program of machines with different file structure. </p> <p> Can it be configurable by some environment variable ? </p> <hr /> <p> Ion Gaztañaga : </p> <p> This seems a good idea. I guess we won't support changing the value of the variable while the program is running, right? For performance reasons, I guess we could just cache the value the first time we access to the environment variable (or maybe in program startup). </p> <p> "BOOST_INTERPROCESS_SHARED_DIR_PATH" is too long for that environment variable name? </p> <hr /> <p> BOOST_IPC_SHARED_DIR is good name for env variable It should be read just at the start of the process (no need to change it during running of the program) </p> <p> thanks a lot! </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10644 Trac 1.4.3 remi.chateauneu@… Wed, 07 Mar 2018 18:03:13 GMT <link>https://svn.boost.org/trac10/ticket/10644#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10644#comment:1</guid> <description> <p> Yes, an environment variable would probably be a good work-around for this: </p> <p> <a class="ext-link" href="https://stackoverflow.com/questions/39742630/boost-shared-memory-cant-be-initialized?noredirect=1&amp;lq=1"><span class="icon">​</span>https://stackoverflow.com/questions/39742630/boost-shared-memory-cant-be-initialized?noredirect=1&amp;lq=1</a> </p> <p> <a class="ext-link" href="https://svn.boost.org/trac10/ticket/12137"><span class="icon">​</span>https://svn.boost.org/trac10/ticket/12137</a> </p> </description> <category>Ticket</category> </item> </channel> </rss>