[llvm-commits] [PATCH] Look up symbols in a specific library with DynamicLibrary

Jordy Rose jediknil at belkadan.com
Tue Aug 2 21:38:42 PDT 2011


This patch adds the ability to look up symbols in a specific library by instantiating llvm::sys::DynamicLibrary. I've tried to make it minimally intrusive and preserve the existing interface (LoadLibraryPermanently and SearchForAddressOfSymbol). Requiring that DynamicLibrary instances must represent already-loaded libraries also means not having to deal with potentially unloaded libraries, though since both dlfcn handles and HMODULEs are ref-counted, that shouldn't be too hard to deal with if we ever lift this restriction.

The use case for this is for Clang plugins loaded with -load, which can have standard entry points like clang_registerASTActions.

The advantages over llvm::Registry:
- it is easier on Windows (or so I've heard)
- it allows us to be lazy (e.g. no need to register plugin AST actions if we're running a standard action)

(I'm not pushing for a change in how ASTConsumer plugins are registered. The impetus for this is coming out of a discussion with Ted, Argyrios, and Anna on pluggable analyzer checkers.)

Is this approach reasonable?
Thanks,
Jordy

P.S. I would especially appreciate if someone could look over my Windows changes; I have very little Windows experience and don't have a Windows dev machine available.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: DynamicLibrary.patch
Type: application/octet-stream
Size: 7665 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110802/c35f3ae2/attachment.obj>


More information about the llvm-commits mailing list