unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Collin Funk <collin.funk1@gmail.com>
Cc: eggert@cs.ucla.edu, bruno@clisp.org, emacs-devel@gnu.org,
	bug-gnulib@gnu.org
Subject: Re: Gnulib's boot-time.c breaks the build with mingw.org's MinGW
Date: Tue, 04 Jun 2024 21:46:41 +0300	[thread overview]
Message-ID: <86sexsk0ku.fsf@gnu.org> (raw)
In-Reply-To: <87ikyok0xb.fsf@gmail.com> (message from Collin Funk on Tue, 04 Jun 2024 11:39:12 -0700)

> From: Collin Funk <collin.funk1@gmail.com>
> Cc: Paul Eggert <eggert@cs.ucla.edu>,  Bruno Haible <bruno@clisp.org>,
>   emacs-devel@gnu.org,  bug-gnulib@gnu.org
> Date: Tue, 04 Jun 2024 11:39:12 -0700
> 
> Eli Zaretskii <eliz@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	other threads:[~2024-06-04 18:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04 16:27 Gnulib's boot-time.c breaks the build with mingw.org's MinGW Eli Zaretskii
2024-06-04 18:39 ` Collin Funk
2024-06-04 18:46   ` Eli Zaretskii [this message]
2024-06-04 19:10     ` Paul Eggert
2024-06-05 11:09       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86sexsk0ku.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=collin.funk1@gmail.com \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).