bug-binutils
[Top][All Lists]
Advanced

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

Re: windres and cmd.exe command line limit


From: Jonathan Liu
Subject: Re: windres and cmd.exe command line limit
Date: Sat, 22 Sep 2012 18:53:51 +1000
User-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:10.0) Gecko/20120206 Thunderbird/10.0

On 8/05/2012 7:17 PM, Joe Burmeister wrote:
I've been doing some QT work with MinGW and run up against that
windres.exe uses popen, which on Windows calls cmd.exe, which only has a
8192 character limit.

Building something in QT (which sometimes has masses of defines) in
Windows with MinGW, was failing with "command line is too long".
I felt the correct thing was that windres.exe didn't have this limit on
Windows, so I've implemented an alternative popen for Windows with a
larger character limit of 32768.

Include the attached file in your build and in resrc.c change:


/*#if defined (_WIN32) && ! defined (__CYGWIN__)
#define popen _popen* *
#define pclose _pclose
#endif*/

to:

*/#if defined (_WIN32) && ! defined (__CYGWIN__)
extern FILE *win_popen_biglimit(const char *command,const char *mode );
extern FILE *win_popen_biglimit(const char *command, const char *mode);
extern int win_pclose_biglimit(FILE *stream);
#undef popen
#define popen win_popen_biglimit
#undef pclose
#define pclose win_pclose_biglimit
#endif/
*

Of course solve this how ever you want, but this is the direction I
think it should go. This can "just work" better than it is. It would be
better if cmd.exe didn't have this low limit, but it does and I doubt MS
are going to fix it anytime soon and even if they did, it wouldn't help
the people running or targeting the existing version of Windows.

Some builds of MinGW have POSIX threads support so popen and pclose are already defined and need to be undef-ed first (see above).

The patch unfortunately breaks reading from standard input.
If you start windres without any arguments from a command prompt after building with the patch applied, it shows the following error:

windres: can't open file `error:': Invalid argument
windres: preprocessing failed.

Regards,
Jonathan



reply via email to

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