
Ion Gaztañaga <igaztanaga <at> gmail.com> writes:
Hi Joaquin,
I've been working on a boost::flyweights::intermodule_holder_class-like intermodule_singleton class. It's in early design state. This class is doing some lazy variable and shared memory initialization, so maybe it can be useful to implement intermodule_holder. It's in trunk, in boost/interprocess/detail/intermodule_singleton.hpp. It's not optimized for windows (it uses file locks and kernel lifetime shared memory, emulating a unix process, it would be much more lightweight using native windows process-lifetime resources) but I think you should try it. I've not tested in DLL-s.
You have a test (intermodule_singleton.cpp) in boost/interprocess/test that shows some use cases.
Hi Ion, I've tried replacing my intermodule_holder code with a simple wrapper around boost::interprocess:detail::intermodule_singleton and unfortunately the problem persists, hitting at the very same line of code with IWbemLocator::ConnectServer. Setting LazyInit to either true or false does nor make a difference. Call stack follows:
intermod_holder_dll.dll!boost::interprocess::winapi:: get_wmi_class_attribute(std::basic_string<wchar_t, std::char_traits<wchar_t>,std::allocator<wchar_t>
& strValue="", const wchar_t * wmi_class=0x100537a8, const wchar_t * wmi_class_var=0x100537dc) Line 1488 C++ intermod_holder_dll.dll!boost::interprocess::winapi:: get_last_bootup_time(std::basic_string<wchar_t,std:: char_traits<wchar_t>,std::allocator<wchar_t> & strValue="") Line 1554 + 0x13 bytes C++
intermod_holder_dll.dll!boost::interprocess::winapi:: get_last_bootup_time(std::basic_string<char,std:: char_traits<char>,std::allocator<char>
& str="") Line 1562 + 0x9 bytes C++
intermod_holder_dll.dll!boost::interprocess::detail:: get_bootstamp(std::basic_string<char,std::char_traits< char>,std::allocator<char>
& s="C:\Documents and Settings\All Users\Application Data/boost_interprocess/", bool add=true) Line 41 + 0x9 bytes C++
intermod_holder_dll.dll!boost::interprocess::detail:: tmp_folder(std::basic_string<char,std::char_traits< char>,std::allocator<char>
& tmp_name="C:\Documents and Settings\All Users\Application Data/boost_interprocess/") Line 108 + 0xb bytes C++
intermod_holder_dll.dll!boost::interprocess::detail:: intermodule_singleton_helpers::remove_old_gmem() Line 162 + 0x9 bytes C++ intermod_holder_dll.dll!boost::interprocess::detail:: intermodule_singleton_common<0>::initialize_shm() Line 733 C++ intermod_holder_dll.dll!boost::interprocess::detail:: intermodule_singleton_common<0>::initialize_singleton_logic( void * & ptr=0x00000000, volatile unsigned int & this_module_singleton_initialized=1, void * (boost::interprocess::basic_managed_shared_memory<char, boost::interprocess::rbtree_best_fit<boost::interprocess:: mutex_family,boost::interprocess::offset_ptr<void>,0>, boost::interprocess::iset_index> &)* constructor=0x1001b72f) Line 832 C++ intermod_holder_dll.dll!boost::interprocess::detail:: intermodule_singleton<boost::flyweights::detail:: flyweight_core<boost::flyweights::detail:: default_value_policy<std::basic_string<char,std:: char_traits<char>,std::allocator<char>
,boost::mpl::na,boost::flyweights::refcounted,boost::
flyweights::hashed_factory<boost::mpl::na,boost::mpl::na, boost::mpl::na,0>,boost::flyweights::simple_locking, boost::flyweights::intermodule_holder>::holder_arg,1>::get() Line 894 + 0x14 bytes C++ intermod_holder_dll.dll!boost::flyweights::detail:: flyweight_core<boost::flyweights::detail:: default_value_policy<std::basic_string<char,std:: char_traits<char>,std::allocator<char>
,boost::mpl::na,boost::flyweights::refcounted,boost::
flyweights::hashed_factory<boost::mpl::na,boost::mpl::na, boost::mpl::na,0>,boost::flyweights::simple_locking, boost::flyweights::intermodule_holder>::init() Line 111 + 0x5 bytes C++ intermod_holder_dll.dll!`dynamic initializer for 'boost::flyweights::detail::flyweight_core<boost::flyweights:: detail::default_value_policy<std::basic_string<char,std:: char_traits<char>,std::allocator<char>
,boost::mpl::na,boost::flyweights::refcounted,boost::
flyweights::hashed_factory<boost::mpl::na,boost::mpl::na, boost::mpl::na,0>,boost::flyweights::simple_locking, boost::flyweights::intermodule_holder>::static_initializer''() Line 218 + 0x23 bytes C++ msvcr80d.dll!1020235a() [Frames below may be incorrect and/or missing, no symbols loaded for msvcr80d.dll] intermod_holder_dll.dll!_CRT_INIT(void * hDllHandle=0x10000000, unsigned long dwReason=1, void * lpreserved=0x0013fd30) Line 313 + 0xf bytes C intermod_holder_dll.dll!__DllMainCRTStartup(void * hDllHandle=0x10000000, unsigned long dwReason=1, void * lpreserved=0x0013fd30) Line 489 + 0x11 bytes C intermod_holder_dll.dll!_DllMainCRTStartup(void * hDllHandle=0x10000000, unsigned long dwReason=1, void * lpreserved=0x0013fd30) Line 459 + 0x11 bytes C ntdll.dll!7c90118a() ntdll.dll!7c91cb82() ntdll.dll!7c90d80a() ntdll.dll!7c923460() ntdll.dll!7c921874() ntdll.dll!7c913f89() ntdll.dll!7c92176f() ntdll.dll!7c919358() ntdll.dll!7c922dfe() ntdll.dll!7c90e457() Joaquín M López Muñoz Telefónica, Investigación y Desarrollo