> From: Collin Funk <collin.fu...@gmail.com>
> Cc: Paul Eggert <egg...@cs.ucla.edu>,  Bruno Haible <br...@clisp.org>,
>   emacs-de...@gnu.org,  bug-gnulib@gnu.org
> Date: Tue, 04 Jun 2024 11:39:12 -0700
> 
> Eli Zaretskii <e...@gnu.org> writes:
> 
> > However, that header is not really needed here because the
> > signature of the GetTickCount64 function, which boot-time-aux.h now
> > calls, is completely defined in boot-time-aux.h:
> >
> >   typedef ULONGLONG (WINAPI * GetTickCount64FuncType) (void);
> [...]
> > So I think the Gnulib code should be amended not to include
> > sysinfoapi.h.  For the time being I made a local change in Emacs, to
> > be able to build the master branch with MinGW, but I don't think it's
> > an Emacs-specific issue.
> 
> Thanks for the report.
> 
> This code was a backup method for getting the boot time on Windows that
> I added recently. On my system #include <windows.h> includes <winbase.h>
> which then includes <sysinfoapi.h> unconditionally. Therefore you are
> correct that there is no need to include it. I've applied the attached
> patch in Gnulib fixing this.

Thanks.  Paul, please import this into our repository when you have
time, reverting my change when you do.

> Were you using an older Windows version perhaps? For older systems where
> the function isn't declared in headers (_WIN32_WINNT < _WIN32_WINNT_VISTA)
> the dll is loaded and it tries to get the function address from there.

I'm on Windows 11, but that's not important.  One can set _WIN32_WINNT
to any value during compilation, regardless of the underlying system.
_WIN32_WINNT is about which versions your application targets when it
runs, as I'm sure you know very well.

In any case, in the case in point we don't need the prototype of
GetTickCount64 because the code calls the function via a function
pointer, and loads it dynamically at run time.

> Note that the line of code you sent is a typedef not a declaration. :)

I know.  But since the function is not called directly, the typedef
declares its signature, and nothing else is required for the code to
compile.  (We could need the header if the code used some macros or
data structures defined on that header, but this is not the case
here.)

Reply via email to