Skip to content

Commit b5d2ac3

Browse files
committed
[cpprestsdk] fix clang build on new zlib
definint dllimport is *bad* and breaks clang, and since this is in maintaince mode they aren't going to fix it. Refs: microsoft/cpprestsdk#1710 llvm/llvm-project#53269
1 parent 77b0517 commit b5d2ac3

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
diff --git a/Release/include/cpprest/details/cpprest_compat.h b/Release/include/cpprest/details/cpprest_compat.h
2+
index bf107479..00581371 100644
3+
--- a/Release/include/cpprest/details/cpprest_compat.h
4+
+++ b/Release/include/cpprest/details/cpprest_compat.h
5+
@@ -29,7 +29,6 @@
6+
#else // ^^^ _WIN32 ^^^ // vvv !_WIN32 vvv
7+
8+
#define __declspec(x) __attribute__((x))
9+
-#define dllimport
10+
#define novtable /* no novtable equivalent */
11+
#define __assume(x) \
12+
do \
13+
@@ -74,9 +73,17 @@
14+
#define _ASYNCRTIMP_TYPEINFO
15+
#else // ^^^ _NO_ASYNCRTIMP ^^^ // vvv !_NO_ASYNCRTIMP vvv
16+
#ifdef _ASYNCRT_EXPORT
17+
+#ifdef _WIN32
18+
#define _ASYNCRTIMP __declspec(dllexport)
19+
+#else
20+
+#define _ASYNCRTIMP __attribute__((visibility("default")))
21+
+#endif
22+
#else // ^^^ _ASYNCRT_EXPORT ^^^ // vvv !_ASYNCRT_EXPORT vvv
23+
+#ifdef _WIN32
24+
#define _ASYNCRTIMP __declspec(dllimport)
25+
+#else
26+
+#define _ASYNCRTIMP
27+
+#endif
28+
#endif // _ASYNCRT_EXPORT
29+
30+
#if defined(_WIN32)
31+
diff --git a/Release/include/pplx/pplx.h b/Release/include/pplx/pplx.h
32+
index d9ba9c61..8d36252c 100644
33+
--- a/Release/include/pplx/pplx.h
34+
+++ b/Release/include/pplx/pplx.h
35+
@@ -30,9 +30,17 @@
36+
#define _PPLXIMP
37+
#else
38+
#ifdef _PPLX_EXPORT
39+
+#ifdef _WIN32
40+
#define _PPLXIMP __declspec(dllexport)
41+
#else
42+
+#define _PPLXIMP __attribute__((visibility("default")))
43+
+#endif
44+
+#else
45+
+#ifdef _WIN32
46+
#define _PPLXIMP __declspec(dllimport)
47+
+#else
48+
+#define _PPLXIMP
49+
+#endif
50+
#endif
51+
#endif
52+

ports/cpprestsdk/portfile.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ vcpkg_from_github(
88
fix-find-openssl.patch
99
fix_narrowing.patch
1010
fix-uwp.patch
11+
fix-clang-dllimport.patch # workaround for https://github.com/microsoft/cpprestsdk/issues/1710
1112
)
1213

1314
set(OPTIONS)

ports/cpprestsdk/vcpkg.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "cpprestsdk",
33
"version": "2.10.19",
4+
"port-version": 1,
45
"description": [
56
"C++11 JSON, REST, and OAuth library",
67
"The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services."

0 commit comments

Comments
 (0)