Compiling program_options v1.35 on msvc9.0 fix

Hi All, I have had some problems compiling program_options v1.35 on visual C++ 9.0 (2008) Express. It seems that this compiler does not correctly export some global variables when compiling to DLL, leading to unresolved dependencies. I have had to make a few changes: In file options_description.hpp, line 158: Replaced static const unsigned m_default_line_length; with BOOST_STATIC_CONSTANT (unsigned, m_default_line_length = 80); This is an old fix that I found in the mail archives (2005), seems to have been erroneously dropped from the base-line. In file options_description.cpp: removed the declaration of m_default_line_length. In file value_semantic.cpp: a singleton variable was defined but not properly linked by vc9.0. I changed the implementation to (line 17) BOOST_PROGRAM_OPTIONS_DECL string& arg() { static string* str=0; if (!str) { str = new string; *str = "arg"; } return *str; } At line 79 (after making the change above), I changed the only use of arg to: std::string untyped_value::name() const { return arg(); } In file details/value_semantic.hpp: I changed the declaration of the variable arg to (line 13): BOOST_PROGRAM_OPTIONS_DECL std::string& arg(); After these changes, program_options links properly, and I was able to run the demo code. Please note that also the pre-compiled version of boost 1.35 for the vc9.0 compiler from http://www.boost-consulting.com/download/windows suffers from these problems: the program_options DLL is unlinkable due to unresolved references to m_default_line_length and arg. Cheerio, Evert van de Waal
participants (1)
-
evert.vandewaal@imtech.nl