e996b0f573af917d8c985bb34fb1ae984a6e903a
[oota-llvm.git] / include / llvm / Support / DynamicLinker.h
1 //===-- llvm/Support/DynamicLinker.h - Portable Dynamic Linker --*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Lightweight interface to dynamic library linking and loading, and dynamic
11 // symbol lookup functionality, in whatever form the operating system
12 // provides it.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_SUPPORT_DYNAMICLINKER_H
17 #define LLVM_SUPPORT_DYNAMICLINKER_H
18
19 #include <string>
20
21 namespace llvm {
22
23 /// LinkDynamicObject - Load the named file as a dynamic library
24 /// and link it with the currently running process. Returns false
25 /// on success, true if there is an error (and sets ErrorMessage
26 /// if it is not NULL). Analogous to dlopen().
27 ///
28 bool LinkDynamicObject (const char *filename, std::string *ErrorMessage);
29
30 /// GetAddressOfSymbol - Returns the address of the named symbol in
31 /// the currently running process, as reported by the dynamic linker,
32 /// or NULL if the symbol does not exist or some other error has
33 /// occurred.
34 ///
35 void *GetAddressOfSymbol (const char *symbolName);
36 void *GetAddressOfSymbol (const std::string &symbolName);
37
38 } // End llvm namespace
39
40 #endif // SUPPORT_DYNAMICLINKER_H