llvm.org GIT mirror llvm / 77b6f2f
Don't use NULL to represent an invalid library; Cygwin uses this for RTLD_DEFAULT. Caught by Takumi. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137841 91177308-0d34-0410-b5e6-96231b3b80d8 Jordy Rose 9 years ago
1 changed file(s) with 7 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
3131 /// Note: there is currently no interface for temporarily loading a library,
3232 /// or for unloading libraries when the LLVM library is unloaded.
3333 class DynamicLibrary {
34 // Placeholder whose address represents an invalid library.
35 // We use this instead of NULL or a pointer-int pair because the OS library
36 // might define 0 or 1 to be "special" handles, such as "search all".
37 static const char Invalid;
38
3439 // Opaque data used to interface with OS-specific dynamic library handling.
3540 void *Data;
3641
37 explicit DynamicLibrary(void *data = 0) : Data(data) {}
42 explicit DynamicLibrary(void *data = &Invalid) : Data(data) {}
3843 public:
3944 /// Returns true if the object refers to a valid library.
40 bool isValid() { return Data != 0; }
45 bool isValid() { return Data != &Invalid; }
4146
4247 /// Searches through the library for the symbol \p symbolName. If it is
4348 /// found, the address of that symbol is returned. If not, NULL is returned.