On Dec 16 17:12, Pedro Alves wrote: > On 12/13/2013 10:37 PM, Pierre Muller wrote: > > Following this thread > > https://sourceware.org/ml/gdb-patches/2013-12/msg00073.html > > > > The patch > > https://sourceware.org/ml/gdb-cvs/2013-12/msg00054.html > > > > introduced a failure for cygwin native build. > > The problem is that __USEWIDE is not considered in the patch. > > > > The patch below fixes this compilation error > > and should allow cygwin to work as mingw. > > Looks fine to me. > > (Though I wonder why not just use GetModuleFileNameExA > explicitly. In fact, it's what gdbserver does). Maybe I'm a bit late, but I'd like to chime in here. Don't use GetModuleFileNameExA, use GetModuleFileNameExW. In theory, you should never use the ANSI API on Windows, unless you're still building GDB for Windows 9x, which should be really, really dead by now, hopefully. The reasons are: - The ANSI API only supports a single- or doublebyte codeset in almost all language versions of Windows. There are only a handful languages which are using UTF-8 as ANSI codeset on Windows, most use something like CP1252 or some other codeset which is not capable of handling all UNICODE characters. - The ANSI API restricts filenames to MAX_PATH (260) characters, while the UNICODE API and the underlying OS allow paths of up to 32K. Cygwin is using the UNICODE and native NT APIs exclusively, so paths in Cygwin are only restricted by the maximum OS capability of 32K, and the influence of the PATH_MAX setting of 4096. Corinna -- Corinna Vinschen Cygwin Maintainer Red Hat