Skip to content

Conversation

@p1-0tr
Copy link
Contributor

@p1-0tr p1-0tr commented May 21, 2025

Older versions of the windows 10 SDK may not have afunix.h. So add logic to detect if the header exists, and enable AF_UNIX only on supported windows versions.

@p1-0tr
Copy link
Contributor Author

p1-0tr commented May 23, 2025

@yhirose I'm not sure why the abidiff step is failing. My change does not touch any function definitions, so it should not fail.

@yhirose
Copy link
Owner

yhirose commented May 23, 2025

@p1-0tr you don't need to worry about the abidiff error.

#include <winsock2.h>
#include <ws2tcpip.h>

#if __has_include(<afunix.h>)
Copy link
Owner

Choose a reason for hiding this comment

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

@p1-0tr this is not compatible with C++11.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know it only got standardised as of c++17, but has been supported by all major compilers before that. I've added an additional check that should protect against errors on compilers that do not support that macro.

httplib.h Outdated
#if __has_include(<afunix.h>)
// afunix.h uses types declared in winsock2.h, so has to be included after it.
#include <afunix.h>
#define HAVE_AFUNIX 1
Copy link
Owner

Choose a reason for hiding this comment

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

@p1-0tr could you please rename it to CPPHTTPLIB_HAVE_AFUNIX_H?

Signed-off-by: Piotr Stankiewicz <[email protected]>
@p1-0tr p1-0tr force-pushed the ps-detect-af-unix branch from e8a70f7 to fac7c9e Compare May 23, 2025 10:44
@yhirose
Copy link
Owner

yhirose commented May 24, 2025

@p1-0tr thanks for the adjustments!

@yhirose yhirose merged commit 4a7aae5 into yhirose:master May 24, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants