[clang] [libclang][Cygwin] Use __declspec(dllexport) for libclang on Cygwin (PR #147122)
Tomohiro Kashiwada via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 4 18:28:39 PDT 2025
https://github.com/kikairoya created https://github.com/llvm/llvm-project/pull/147122
This is needed for Cygwin build without `-DLLVM_LINK_LLVM_DYLIB=ON`, otherwise causes a linker error 'export ordinal too large'.
>From 4406a457b7cf3713dc9bea67bd7b68ecb61966bd Mon Sep 17 00:00:00 2001
From: kikairoya <kikairoya at gmail.com>
Date: Sat, 28 Jun 2025 10:54:25 +0900
Subject: [PATCH] [libclang][Cygwin] Use __declspec(dllexport) for libclang on
Cygwin
This is needed for Cygwin build without LLVM_LINK_LLVM_DYLIB, otherwise
causes a linker error 'export ordinal too large'.
---
clang/include/clang-c/Platform.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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)
More information about the cfe-commits
mailing list