[llvm] [llvm-c] Guard include of llvm-config in Visibility.h (PR #154229)

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 19 11:56:59 PDT 2025


compnerd wrote:

> > This requires that LLVMSupport_STATIC, LLVM_STATIC, and LLVMBackend_STATIC are mapped to exactly how the dependency was configured and built. Additionally, you need to ensure that any other macros are also identically configured. This is why the CMake generated header being exposed is the right thing to do
> 
> I am not sure why exporting C interface requires exporting c++ interface on Windows...

Oh, that is easy to answer: because it does! There is no true C API to LLVM. The C API is bit just a shim over the C++ interfaces. The configuration here is required to actually import the C++ interface. We _could_ completely sink the implementation into a `.cpp` file, and make the header completely opaque, but I think that would be a larger change (but one that I would be in favour of).
 
> I guess the other alternative is that we can preprocess the headers when installing them so the installed C headers don't need to have dependency on config?

Hmm, do you have a portable mechanism for doing this? Remember that we should only rely on tools that are available on Windows natively rather than grow a new dependency.

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


More information about the llvm-commits mailing list