Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export LLVM plugin entrypoint for windows shared library builds #115431

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions llvm/include/llvm/Passes/PassPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks a really painful way to declare it.


#endif /* LLVM_PASSES_PASSPLUGIN_H */
Loading