lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] MinGW, wstring, and wstream [Was: patch: compilation fix for wx 2.


From: Greg Chicares
Subject: [lmi] MinGW, wstring, and wstream [Was: patch: compilation fix for wx 2.9]
Date: Sat, 15 May 2010 12:59:12 +0000
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

On 2010-05-15 12:30Z, Vadim Zeitlin wrote:
> On Sat, 15 May 2010 14:23:37 +0200 Vaclav Slavik <address@hidden> wrote:
> 
> VS> >  - MinGW gcc, IIRC, doesn't support wide strings, at least not for
> VS> >    gcc-3.x (which is what we still use for production). 
> VS> 
> VS> I'm not aware of such limitations. Looking at Poedit VCS history, its
> VS> version 1.3.5 required Unicode build of wx and was compiled with MinGW
> VS> 3.4.
> 
>  MinGW 3.x console IO doesn't support Unicode AFAIK. But this is not the
> main problem, it's the lack of support for Unicode file names in
> std::fstream (and lack of extensions in GNU C++ library to remedy this)
> that is. IOW we can support Unicode file names with MinGW, of course. But
> only using wx and not std::fstream.

MinGW provides wstring, but not wstream:

  http://article.gmane.org/gmane.comp.gnu.mingw.user/10083/
  http://article.gmane.org/gmane.comp.gnu.mingw.user/13123/

We could use <boost/filesystem/fstream.hpp>, but I doubt that would help:

  http://www.cygwin.com/ml/cygwin/2009-01/msg00436.html

I'd strongly prefer to write as much code as we can in the subset of
standard C++ that's supported by the compiler we use for production
releases, keeping lmi's core independent of wx. Within that limitation,
there's not much we can do to permit wide characters here:

  bool CensusDocument::DoSaveDocument(wxString const& filename)
  {
+     std::ofstream ofs(filename.mb_str(), ios_out_trunc_binary());
-     std::ofstream ofs(filename.c_str(), ios_out_trunc_binary());
      doc_.write(ofs);

unless we fall back on <cstdio>, which is just too balky.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]