Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#5994 closed Patches (wontfix)

MSVC compiler misbehaviour - .lib & .exp files build for .EXE project

Reported by: piotr.ns2011@… Owned by: Chris Newbold
Milestone: To Be Determined Component: pool
Version: Boost 1.47.0 Severity: Cosmetic
Keywords: Cc:

Description

There is bug in VS 2010 (and older versions) which makes EXE projects to build .LIB and .EXP files when using DLL runtime and "new (std::nothrow)" - as in "boost\pool" default_user_allocator_new_delete.

The patch below is a workaround for this problem. According to this page: http://bit.ly/nCKoel there are no plans to fix this error on MSVC side.

// -- file: 
//   boost\pool\pool.hpp
// -- under 
//   static char * malloc BOOST_PREVENT_MACRO_SUBSTITUTION(const size_type bytes)
// -- replace
//   { return new (std::nothrow) char[bytes]; }
// -- with:
#if defined(_DLL) && defined(_MSC_VER)
  { try { return new char[bytes]; } catch (...) { return NULL; } }
#else
  { return new (std::nothrow) char[bytes]; }
#endif

Change History (2)

comment:1 by Steven Watanabe, 11 years ago

Resolution: wontfix
Status: newclosed

Is there some reason that you can't just ignore the extra files? I object to obfuscating the code like this.

comment:2 by piotr.ns2011@…, 11 years ago

Yes, I can ignore these files, but it's an additional build step that could be avoided. And this is the only piece of code in the whole boost library which adds this step. Note that I've set this ticket's severity to "cosmetic", so I can live without this change.

Note: See TracTickets for help on using tickets.