[clang] [libclang] Add missing dllexport annotation (PR #147108)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 6 13:58:15 PDT 2025


mstorsjo wrote:

> > > Still it may be good to figure out why this hasn't been an issue so far, for whoever otherwise were using these dllexport annotations.
> > 
> > 
> > I suspect it relates to module definition file (*.def). On MinGW, the symbol is properly exported without annotation.
> 
> Regular win32 targets use `libclang.def` to choose symbols to be exported (generated from `libclang-generic.exports` through `LLVM_EXPORT_SYMBOL_FILE`) but it's disabled on most of Unix platforms.
> 
> https://github.com/llvm/llvm-project/blob/53359252688692f2b0e25f529335848db94cc166/clang/tools/libclang/CMakeLists.txt#L95-L98
> 
> It seems `AND NOT CYGWIN` should be added here.

That sounds like a good addition too, even if we're doing this as well?

> Even if exported symbols are controlled by `libclang.def`, annotating `__declspec(dllimport)` correctly is still preferred.

Yeah, making that complete sounds good to me.

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


More information about the cfe-commits mailing list