Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle_t: Windows-specific name collision #531

Closed
petervdonovan opened this issue Sep 23, 2021 · 3 comments · Fixed by #532
Closed

handle_t: Windows-specific name collision #531

petervdonovan opened this issue Sep 23, 2021 · 3 comments · Fixed by #532
Labels
bug Something isn't working c Related to C target compiler windows Related to the Microsoft Windows platform

Comments

@petervdonovan
Copy link
Collaborator

There seems to be a Windows-specific name collision that results from handle_t being defined as an alias for RPC_BINDING_HANDLE on Windows. I'm not sure because I am not experienced with C, but this page seems to explain the problem.

Minimal Example

Here is a minimal example required to reproduce the error.

Directory structure:

test
│  test.c
│  CMakeLists.txt
└─ build

Content of test.c:

#include <windows.h>
typedef int handle_t;

Content of CMakeLists.txt:

cmake_minimum_required(VERSION 3.10)
project(test)
add_executable(test test.c)

Error message after running cmake .. and cmake --build . in the build directory:

Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  test.c
C:\Users\Peter\Downloads\test\test.c(3): error C2040: 'handle_t': 'int' differs in levels of indirection from 'RPC_BINDING_HANDLE' [C:\Us
ers\Peter\Downloads\test\build\test.vcxproj]

Context

In case it matters, I ran into this issue while working on the language server because (after adding a semicolon in windows_support.h). CMake fails to build and gives a long list of errors, including this one. I do not know how many of the errors are cascading errors that result from this name collision. The relevant error message is

example\src-gen\reflexgame\core/reactor.h(340): error C2040: 'handle_t': 'int' differs in levels of indirect
ion from 'RPC_BINDING_HANDLE'
@petervdonovan petervdonovan added bug Something isn't working compiler c Related to C target windows Related to the Microsoft Windows platform labels Sep 23, 2021
@Soroosh129
Copy link
Contributor

This is already solved in windows-c-target. There are a few remaining issues to get the Windows support to fully work. Are you interested?

@lhstrh
Copy link
Member

lhstrh commented Sep 23, 2021

@Soroosh129: best create a draft PR for this to increase visibility.

@lhstrh
Copy link
Member

lhstrh commented Oct 5, 2021

Looks like this is subsumed by #532

@lhstrh lhstrh closed this as completed Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working c Related to C target compiler windows Related to the Microsoft Windows platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants