| 1 | // | 
|---|
| 2 | // SharedLibrary_UNIX.h | 
|---|
| 3 | // | 
|---|
| 4 | // Library: Foundation | 
|---|
| 5 | // Package: SharedLibrary | 
|---|
| 6 | // Module:  SharedLibrary | 
|---|
| 7 | // | 
|---|
| 8 | // Definition of the SharedLibraryImpl class for UNIX (dlopen). | 
|---|
| 9 | // | 
|---|
| 10 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | 
|---|
| 11 | // and Contributors. | 
|---|
| 12 | // | 
|---|
| 13 | // SPDX-License-Identifier:	BSL-1.0 | 
|---|
| 14 | // | 
|---|
| 15 |  | 
|---|
| 16 |  | 
|---|
| 17 | #ifndef Foundation_SharedLibrary_UNIX_INCLUDED | 
|---|
| 18 | #define Foundation_SharedLibrary_UNIX_INCLUDED | 
|---|
| 19 |  | 
|---|
| 20 |  | 
|---|
| 21 | #include "Poco/Foundation.h" | 
|---|
| 22 | #include "Poco/Mutex.h" | 
|---|
| 23 |  | 
|---|
| 24 |  | 
|---|
| 25 | namespace Poco { | 
|---|
| 26 |  | 
|---|
| 27 |  | 
|---|
| 28 | class Foundation_API SharedLibraryImpl | 
|---|
| 29 | { | 
|---|
| 30 | protected: | 
|---|
| 31 | enum Flags | 
|---|
| 32 | { | 
|---|
| 33 | SHLIB_GLOBAL_IMPL = 1, | 
|---|
| 34 | SHLIB_LOCAL_IMPL  = 2 | 
|---|
| 35 | }; | 
|---|
| 36 |  | 
|---|
| 37 | SharedLibraryImpl(); | 
|---|
| 38 | ~SharedLibraryImpl(); | 
|---|
| 39 | void loadImpl(const std::string& path, int flags); | 
|---|
| 40 | void unloadImpl(); | 
|---|
| 41 | bool isLoadedImpl() const; | 
|---|
| 42 | void* findSymbolImpl(const std::string& name); | 
|---|
| 43 | const std::string& getPathImpl() const; | 
|---|
| 44 | static std::string prefixImpl(); | 
|---|
| 45 | static std::string suffixImpl(); | 
|---|
| 46 |  | 
|---|
| 47 | private: | 
|---|
| 48 | std::string _path; | 
|---|
| 49 | void* _handle; | 
|---|
| 50 | static FastMutex _mutex; | 
|---|
| 51 | }; | 
|---|
| 52 |  | 
|---|
| 53 |  | 
|---|
| 54 | } // namespace Poco | 
|---|
| 55 |  | 
|---|
| 56 |  | 
|---|
| 57 | #endif // Foundation_SharedLibrary_UNIX_INCLUDED | 
|---|
| 58 |  | 
|---|