Skip to content

Support for EventToken.h on mingw64 #45

@W1M0R

Description

@W1M0R

@SteffenL Sorry for bringing this up again, because I know you have answered this question so many times:

  1. Compilation prompts missing files #40
  2. compilation error #32 (comment)
  3. #include "EventToken.h" error #21 (comment)
  4. compilation error #20 (comment)
  5. compilation error #20 (comment)
  6. fatal error: EventToken.h: No such file or directory #17 (comment)
  7. Error In webview.h #8 (comment)

I have a suggestion that might add better support for mingw64. Here are a few examples I want to present:

  1. https://learn.microsoft.com/en-us/windows/win32/api/eventtoken/
  2. https://github.com/microsoft/win32metadata/blob/main/generation/WinSDK/RecompiledIdlHeaders/winrt/EventToken.h
  3. https://learn.microsoft.com/en-us/windows/win32/api/eventtoken/ns-eventtoken-eventregistrationtoken
  4. https://github.com/mingw-w64/mingw-w64/blob/master/mingw-w64-headers/include/eventtoken.h
  5. https://github.com/ziglang/zig/blob/9be8a9000faead40b1aec4877506ff10b066659c/lib/libc/include/any-windows-any/eventtoken.h#L4
  6. https://github.com/search?q=eventtoken.h&type=code&p=2

Here is a screenshot of the file on my local system:

image

The associated verbose build output:

TERM='dumb' x86_64-w64-mingw32-g++ -I . -m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b500=/tmp/go-build -gno-record-gcc-switches -I $WORK/b500/ -I/nix/store/57s2nhck96xz82vpdq92jkii9c1q2bdq-mingw-w64-x86_64-w64-mingw32-11.0.1-headers/include -I/home/user/go/pkg/mod/github.com/webview/[email protected]/libs/webview/include -DWEBVIEW_STATIC -DWEBVIEW_EDGE -std=c++14 -I/home/user/go/pkg/mod/github.com/webview/[email protected]/libs/mswebview2/include -frandom-seed=Isb35zOTZ8oW2P-K900j -o $WORK/b500/_x004.o -c webview.cc
# github.com/webview/webview_go
In file included from /home/user/go/pkg/mod/github.com/webview/[email protected]/libs/webview/include/webview.h:2076,
                 from webview.cc:1:
/home/user/go/pkg/mod/github.com/webview/[email protected]/libs/mswebview2/include/WebView2.h:978:10: fatal error: EventToken.h: No such file or directory
  978 | #include "EventToken.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.

The important part in the above output is the additional header location added via -I/nix/store/57s2nhck96xz82vpdq92jkii9c1q2bdq-mingw-w64-x86_64-w64-mingw32-11.0.1-headers/include, so that eventtoken.h will be available for include.

It looks like the convention for referencing the "EventToken.h" header with the mingw-64 compilation toolchain, is to use lowercase, e.g. <eventtoken.h>. The Windows API docs itself also refers to this header in lowercase. However, searching GitHub, I can see that both variants are used.

What I'm trying to figure out, is whether this generated file (https://github.com/webview/webview_go/blob/master/libs/mswebview2/include/WebView2.h) could somehow be patched to use a lowercase include of eventtoken.h, and whether that would still work for non-mingw builds.

@SteffenL Do you have insight in how WebView2.h is generated and whether somewhere in the process a lowercase include of eventtoken.h can be used (if not for every toolchain, then specifically for the mingw toolchain)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions