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

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 11:20:18 PST 2024


================
@@ -107,7 +107,7 @@ class PassPlugin {
 ///   };
 /// }
 /// ```
-extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK
+extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK LLVM_ABI_EXPORT
----------------
compnerd wrote:

I find this a little misleading ... I think I would personally prefer:

```c
#if defined(_WIN32)
__declspec(dllexport)
#endif
```

The reasoning is that this is not the LLVM ABI but the plugin's ABI. But, I think that getting things working this way with a reference to an issue to clean up is fine.

How does this work within LLVM however? The declaration should be:

```c
extern "C" ::llvm::PassPluginLibraryInfo __declspec(dllimport)
llvmGetPassPluginInfo();
```

when this is being referenced in LLVM itself.

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


More information about the llvm-commits mailing list