Opened 4 years ago

Last modified 5 months ago

#9262 reopened Bugs

windows_intermodule_singleton breaks when calling a Debug dll from a Release executable

Reported by: Lars Hagström <lars@…> Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:


A simplified example of what goes wrong (the reality is more complex, and also very difficult for me to change):

On Windows I have an exe and a dll that both use boost.interprocess. The dll interface is C-like, so that the exe and dll can use different runtimes (i.e. Debug and Release runtimes). This works fine as long as I comment out the BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME define in workaround.hpp. But if I leave that define in the code I will get random access violations deep inside the tmp_folder function (or one of the other functions in tmp_dir_helpers).

I believe that this is due to the windows_intermodule_singleton, which is only used when ...HAS_KERNEL_BOOTTIME is defined. This singleton will get created in one runtime and then accessed in another, which does not work since it contains a std::map, which is an STL object that is not possible to pass between runtimes in Visual C++.

If it is possible to fix this that would be great, but the other option would be a "nicer" way to turn off the singleton without having to patch one of the boost headers.

Attachments (0)

Change History (5)

comment:1 Changed 3 years ago by Ion Gaztañaga

Boost 1.56 replaces std::map with boost::container::map so maybe now you can mix runtimes.

comment:2 Changed 3 years ago by lars@…

Yes, this seems to work now! Thanks!

comment:3 Changed 3 years ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

Thanks for the report, closing the issue.

comment:4 in reply to:  1 Changed 3 years ago by emil.styrke@…

Replying to igaztanaga:

Boost 1.56 replaces std::map with boost::container::map so maybe now you can mix runtimes.

What if I have an application with two modules that use different versions of Boost (For example one uses 1.55 and one uses 1.56)? I tried reading the code but I can't really tell if there is any versioning mechanism in place.

The practical case: we use Boost in a shared library that we sell to customers. A customer might use other third-party libraries that in turn use Boost of a different version.

comment:5 Changed 5 months ago by sakhnik@…

Resolution: fixed
Status: closedreopened

I believe the last comment raises a valid concern. If I have an extensive dll-based plugin system, where different ones are linking with different versions of boost, it gets impossible to debug when using boost::interprocess.

Modify Ticket

Change Properties
Set your email in Preferences
as reopened The owner will remain Ion Gaztañaga.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.