Boost logo

Boost Users :

Subject: [Boost-users] [1.49][filesystem] problem while instantiating a global bfs::path variable
From: Jan Boehme (jan.boehme_at_[hidden])
Date: 2012-05-16 10:56:50


Hello,

using a global path variable as in the following sample is no longer
possible when using 1.49 under Windows:

#include <iostream>
#include <boost/filesystem.hpp>

boost::filesystem::path global_path(".");

int main()
{
    std::cout << global_path << std::endl;
    return 0;
}

The program crashes while starting. The following backtrace was captured:

> msvcp100d.dll!std::codecvt<wchar_t,char,int>::in(int & _State=0, const char * _First1=0x00000000002af760, const char * _Last1=0x00000000002af761, const char * & _Mid1=0x0000000000000000, wchar_t * _First2=0x00000000002af460, wchar_t * _Last2=0x00000000002af660, wchar_t * & _Mid2=0x0000000000000000) Line 1521 + 0x5 bytes C++
> global_path.exe!`anonymous namespace'::convert_aux(const char * from=0x00000000002af760, const char * from_end=0x00000000002af761, wchar_t * to=0x00000000002af460, wchar_t * to_end=0x00000000002af660, std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > & target="", const std::codecvt<wchar_t,char,int> & cvt={...}) Line 84 + 0x5a bytes C++
> global_path.exe!boost::filesystem3::path_traits::convert(const char * from=0x00000000002af760, const char * from_end=0x00000000002af761, std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > & to="", const std::codecvt<wchar_t,char,int> & cvt={...}) Line 167 C++
> global_path.exe!boost::filesystem3::path_traits::dispatch<std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > >(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & c=".", std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > & to="", const std::codecvt<wchar_t,char,int> & cvt={...}) Line 174 + 0x9e bytes C++
> global_path.exe!boost::filesystem3::path::path<char const [2]>(const char [2]& source=0x000000013fa435d4, void * __formal=0x0000000000000000) Line 135 + 0x2d bytes C++
> global_path.exe!`dynamic initializer for 'global_path''() Line 4 + 0x1a bytes C++
> msvcr100d.dll!_initterm(void (void)* * pfbegin=0x000000013fa433d0, void (void)* * pfend=0x000000013fa43418) Line 873 C
> global_path.exe!__tmainCRTStartup() Line 474 C
> global_path.exe!mainCRTStartup() Line 371 C
> kernel32.dll!000000007695652d()
> [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
> ntdll.dll!0000000076dec521()

The program was built using boost 1.49 under Windows 7 and MSVC 10. The
same sample works as expected using Boost 1.48 while keeping the rest
untouched.

Thanks for clarification,
Jan.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net