Skip to content

Fix ARM64 build by defining WIN32#9654

Merged
DHowett merged 1 commit intomainfrom
dev/miniksa/fix_arm64
Mar 29, 2021
Merged

Fix ARM64 build by defining WIN32#9654
DHowett merged 1 commit intomainfrom
dev/miniksa/fix_arm64

Conversation

@miniksa
Copy link
Member

@miniksa miniksa commented Mar 29, 2021

By default from ARM64 architecture projects, WIN32 is not defined. It is supposed to be for this proxy stub to work. So I've set it with the preprocessor for this project.

PR Checklist

Detailed Description of the Pull Request / Additional comments

WIN32 appears to convey two meanings depending on who you are:

  • To most of Windows, WIN32 appears to mean the Win32 API surface and sometimes the major OS version that goes with it. (Specifically in contrast to 16-bit Windows.)
  • To others, WIN32 appears to mean a 32-bit processor or a synonym of x86.

This is generally not a problem for a few reasons:

  • VS defines WIN32 in the default targets/props only for the x86 processor type. BUT
  • Windows defines WIN32 if it's not already defined in both minwinbase.h and ole2.h which generally speaking manage to get compiled into practically everything especially since minwinbase.h tends to sneak itself in somehow through windows.h and that's THE include to use the Windows API surface.
  • Windows also defines WIN32 for itself unconditionally and relatively globally when building itself.

However, it's a problem here because:

  • rpcproxy.h is the only header included in dlldata.c, a file generated automatically by midl.exe in the SDK when making a proxy stub.
  • rpcproxy.h only defines its contents for a proxy when WIN32 or _M_AMD64 are found.
  • Therefore, it's defined pretty naturally for x86 and AMD64 targets from VS, but not for ARM64.
  • ARM64 support is pretty new and those who are attempting to build for ARM64 and against the public SDK with Visual Studio for a classic COM proxy... seems like a relatively unlikely combination.

I will follow up with the Visual Studio, Windows SDK, and MIDL/COM teams to try to remove this pitfall from the public tooling. But for now, this is the fix.

… be implying WIN32 vs 16-bit windows...not the 32v64 architecture.
@miniksa miniksa self-assigned this Mar 29, 2021
@miniksa miniksa added Area-Build Issues pertaining to the build system, CI, infrastructure, meta Area-DefApp Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Conhost For issues in the Console codebase Product-Terminal The new Windows Terminal. labels Mar 29, 2021
@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Mar 29, 2021
@ghost
Copy link

ghost commented Mar 29, 2021

Hello @DHowett!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 8 hours, a condition that will be fulfilled in about 7 hours 57 minutes. No worries though, I will be back when the time is right! 😉

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@DHowett
Copy link
Member

DHowett commented Mar 29, 2021

@msftbot merge this in 7 minutes

@ghost
Copy link

ghost commented Mar 29, 2021

Hello @DHowett!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I won't merge this pull request until after the UTC date Mon, 29 Mar 2021 21:24:30 GMT, which is in 7 minutes

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@DHowett DHowett merged commit d695424 into main Mar 29, 2021
@DHowett DHowett deleted the dev/miniksa/fix_arm64 branch March 29, 2021 21:43
<PreprocessorDefinitions>REGISTER_PROXY_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CallingConvention>StdCall</CallingConvention>
<!-- Must be Stdcall on all platforms to resolve _ObjectStublessClient3 -->
<PreprocessorDefinitions>REGISTER_PROXY_DLL;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want this defined for everything? Or just some flavors (e.g. ARM64)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since minwindefs defines it for everyone if it didn't already exist, I suspect there's no harm in us doing it for every flavor of everything 😄 Good catch though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Build Issues pertaining to the build system, CI, infrastructure, meta Area-DefApp AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Conhost For issues in the Console codebase Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants