[clang] [libclang][Cygwin] Use __declspec(dllexport) for libclang on Cygwin (PR #147122)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 4 18:29:08 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Tomohiro Kashiwada (kikairoya)

<details>
<summary>Changes</summary>

This is needed for Cygwin build without `-DLLVM_LINK_LLVM_DYLIB=ON`, otherwise causes a linker error 'export ordinal too large'.

---
Full diff: https://github.com/llvm/llvm-project/pull/147122.diff


1 Files Affected:

- (modified) clang/include/clang-c/Platform.h (+1-1) 


``````````diff
diff --git a/clang/include/clang-c/Platform.h b/clang/include/clang-c/Platform.h
index 67c1fff8ff783..8d341ddd6f8eb 100644
--- a/clang/include/clang-c/Platform.h
+++ b/clang/include/clang-c/Platform.h
@@ -22,7 +22,7 @@ LLVM_CLANG_C_EXTERN_C_BEGIN
 #ifndef CINDEX_NO_EXPORTS
   #define CINDEX_EXPORTS
 #endif
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
   #ifdef CINDEX_EXPORTS
     #ifdef _CINDEX_LIB_
       #define CINDEX_LINKAGE __declspec(dllexport)

``````````

</details>


https://github.com/llvm/llvm-project/pull/147122


More information about the cfe-commits mailing list