all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Build failure on Windows using MSVC
@ 2008-08-15  7:49 dhruva
  2008-08-15  9:31 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: dhruva @ 2008-08-15  7:49 UTC (permalink / raw)
  To: Emacs Development

Hi,
 Build of Emacs from HEAD on WXP using MSVC 2003 fails due to redefinition of a structure MEMORYSTATUSEX. The following patch fixes the issue on WXP (W2K prof and upwards as that structure is available on W2K+). Need to test on older versions and I have no access to it.

=== modified file 'src/w32.c'
--- src/w32.c   2008-08-10 01:05:02 +0000
+++ src/w32..c   2008-08-15 07:43:51 +0000
@@ -73,6 +73,7 @@
 #define _ANONYMOUS_STRUCT
 #endif
 #include <windows.h>
+#if (WINVER<0x0500)
 /* This is guarded by a higher value of _WIN32_WINNT than what we use.  */
 typedef struct _MEMORYSTATUSEX {
         DWORD dwLength;
@@ -85,7 +86,7 @@
         DWORDLONG ullAvailVirtual;
         DWORDLONG ullAvailExtendedVirtual;
 } MEMORYSTATUSEX,*LPMEMORYSTATUSEX;
-
+#endif
 #include <lmcons.h>
 #include <shlobj.h>

-dhruva



      Add more friends to your messenger and enjoy! Go to http://in.messenger.yahoo.com/invite/





^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: Build failure on Windows using MSVC
@ 2008-08-15 12:37 dhruva
  0 siblings, 0 replies; 4+ messages in thread
From: dhruva @ 2008-08-15 12:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Hi Eli,
 This is the error message I get when I get to compile. I agree WINVER is deprecated but _WIN32_WINNT is not defined after including windows..h, I therefore used WINVER instead which is defined. For sake of completeness, the windows.h comes from the PlatformSDK installed as part of Visual Studio installation.
 Another alternative at fixing this would be to test it in configure. That may be a foolproof approach.

The compilation error I notice:

        cl -I. -nologo -c -Zel -W2 -H63 -Oxsb2 -Oy- -G6dF -Zp8 -Zi   /Ic:/tools/msvcimage/include -Demacs=1 -DHAVE_CONFIG_H -I../nt/inc -DHAVE_NTGUI=1  -Foobj-spd/i386\ w32.c
w32.c
w32.c(78) : error C2011: '_MEMORYSTATUSEX' : 'struct' type redefinition
        C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinBase.h(1723) : see declaration of '_MEMORYSTATUSEX'
w32.c(3605) : warning C4244: '=' : conversion from 'long double' to 'long', possible loss of data
w32.c(3606) : warning C4244: '=' : conversion from 'long double' to 'long', possible loss of data
w32.c(3609) : warning C4244: '=' : conversion from 'long double' to 'long', possible loss of data
w32.c(3610) : warning C4244: '=' : conversion from 'long double' to 'long', possible loss of data
w32.c(3616) : warning C4244: '=' : conversion from 'long double' to 'long', possible loss of data
w32.c(3617) : warning C4244: '=' : conversion from 'long double' to 'long', possible loss of data
w32.c(3621) : warning C4244: '=' : conversion from 'long double' to 'long', possible loss of data
w32.c(3622) : warning C4244: '=' : conversion from 'long double' to 'long', possible loss of data
w32.c(3668) : warning C4244: '=' : conversion from 'double' to 'DWORD', possible loss of data
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\BIN\nmake.exe"' : return code '0x2'
Stop.

-dhruva



----- Original Message ----
> From: Eli Zaretskii <eliz@gnu.org>
> To: dhruva <dhruva@ymail.com>
> Cc: emacs-devel@gnu.org
> Sent: Friday, 15 August, 2008 3:01:13 PM
> Subject: Re: Build failure on Windows using MSVC
> 
> > Date: Fri, 15 Aug 2008 13:19:37 +0530 (IST)
> > From: dhruva 
> > 
> >  Build of Emacs from HEAD on WXP using MSVC 2003 fails due to redefinition of 
> a structure MEMORYSTATUSEX. The following patch fixes the issue on WXP (W2K prof 
> and upwards as that structure is available on W2K+). Need to test on older 
> versions and I have no access to it.
> 
> What is the exact error message emitted by Studio 2003?  Is there
> perhaps a compiler switch to avoid such an error?  Is our definition
> incompatible with what VS 2003 defines?
> 
> I need the above information to come up with a suitable solution that
> will work with all supported platforms and compiler versions.  Someone
> else compiled this CVS code with VS 6 and didn't have this problem, so
> we need to find a solution that doesn't break versions of VS other
> than yours.
> 
> > === modified file 'src/w32.c'
> > --- src/w32.c   2008-08-10 01:05:02 +0000
> > +++ src/w32..c   2008-08-15 07:43:51 +0000
> > @@ -73,6 +73,7 @@
> >  #define _ANONYMOUS_STRUCT
> >  #endif
> >  #include 
> > +#if (WINVER<0x0500)
> 
> I don't want to use WINVER.  It's an old and deprecated macro, and we
> already use its more modern replacement _WIN32_WINNT.  Also, the
> availability of the function at run time is not an issue here, since
> the code dynamically tests that and only uses the function if it's
> available.  The issue is compilation.
> 
> From your report, I understand that the MS header files do not guard
> the declaration of MEMORYSTATUSEX with _WIN32_WINNT, like the MinGW
> headers do?  Can you verify that, please?
> 
> If this is so, I prefer to condition the declaration on __MINGW32__
> rather than use WINVER.  The only thing that bothers me is VS 6 (see
> above).



      Unlimited freedom, unlimited storage. Get it now, on http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-08-15 12:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-15  7:49 Build failure on Windows using MSVC dhruva
2008-08-15  9:31 ` Eli Zaretskii
2008-08-15 12:50   ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2008-08-15 12:37 dhruva

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.