This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] libiberty/physmem support for w32


 > From: Zack Weinberg <zack at codesourcery dot com>
 > 
 > Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz> writes:
 > 
 > > Hello
 > >
 > > This adds physmem support for _WIN32. Note that cygwin doesn't define
 > > _WIN32 by default.  However, cygwin doesn't need this because it has
 > >  working sysconf.
 > >
 > > The code may seem overly complicated.  Here is the reason: All win32
 > > system have GlobalMemoryStatus which provides the requested values.
 > > However, GlobalMemoryStatus is broken for physmen > 4GB, returning
 > > physmem modulo 4GB.  GlobalMemoryStatusEx overcomes this, but is
 > > onlay available on Win2k and WinXP, AFAICT.  Hence we try a runtime
 > > link to GlobalMemoryStatusEx in the shared kernel library rather
 > > than a load time link.
 > 
 > Please factor common code out to a helper routine.
 > zw

Zack - I looked and couldn't figure out how exactly to factor out any
code that didn't make things especially ugly.  The only thing that
comes out easily is the one function call to
GetModuleHandle("kernel32.dll").

The rest of the code, because it uses different structs and members
ends up being unique.  Perhaps I'm missing something, if so please
help me understand what it is.  Otherwise I'd like to consider the
code as supplied.

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			ghazi at caip dot rutgers dot edu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]