[llvm] Export LLVM plugin entrypoint for windows shared library builds (PR #115431)

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 13:23:05 PST 2024


================
@@ -107,7 +107,13 @@ class PassPlugin {
 ///   };
 /// }
 /// ```
+
+#if defined(_WIN32) && defined(LLVM_BUILD_LLVM_DYLIB)
+extern "C" ::llvm::PassPluginLibraryInfo __declspec(dllexport)
+llvmGetPassPluginInfo();
+#else
 extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK
 llvmGetPassPluginInfo();
+#endif
----------------
compnerd wrote:

I think that we can share most of the declaration between the platforms, it is only the attribute that differs.

```c
extern "C" ::llvm::PassPluginLibraryInfo
#if defined(_WIN32)
#if defined(LLVM_BUILD_LLVM_DYLIB)
__declspec(dllexport)
#endif
#else
LLVM_ATTRIBUTE_WEAK
#endif
llvmGetPassPluginInfo();
```

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


More information about the llvm-commits mailing list