00001 // 00002 // SharedLibrary.h 00003 // 00004 // $Id: //poco/1.3/Foundation/include/Poco/SharedLibrary.h#1 $ 00005 // 00006 // Library: Foundation 00007 // Package: SharedLibrary 00008 // Module: SharedLibrary 00009 // 00010 // Definition of the SharedLibrary class. 00011 // 00012 // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 00013 // and Contributors. 00014 // 00015 // Permission is hereby granted, free of charge, to any person or organization 00016 // obtaining a copy of the software and accompanying documentation covered by 00017 // this license (the "Software") to use, reproduce, display, distribute, 00018 // execute, and transmit the Software, and to prepare derivative works of the 00019 // Software, and to permit third-parties to whom the Software is furnished to 00020 // do so, all subject to the following: 00021 // 00022 // The copyright notices in the Software and this entire statement, including 00023 // the above license grant, this restriction and the following disclaimer, 00024 // must be included in all copies of the Software, in whole or in part, and 00025 // all derivative works of the Software, unless such copies or derivative 00026 // works are solely in the form of machine-executable object code generated by 00027 // a source language processor. 00028 // 00029 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00030 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00031 // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 00032 // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 00033 // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 00034 // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00035 // DEALINGS IN THE SOFTWARE. 00036 // 00037 00038 00039 #ifndef Foundation_SharedLibrary_INCLUDED 00040 #define Foundation_SharedLibrary_INCLUDED 00041 00042 00043 #include "Poco/Foundation.h" 00044 00045 00046 #if defined(hpux) || defined(_hpux) 00047 #include "Poco/SharedLibrary_HPUX.h" 00048 #elif defined(POCO_OS_FAMILY_UNIX) 00049 #include "Poco/SharedLibrary_UNIX.h" 00050 #elif defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8) 00051 #include "Poco/SharedLibrary_WIN32U.h" 00052 #elif defined(POCO_OS_FAMILY_WINDOWS) 00053 #include "Poco/SharedLibrary_WIN32.h" 00054 #elif defined(POCO_OS_FAMILY_VMS) 00055 #include "Poco/SharedLibrary_VMS.h" 00056 #endif 00057 00058 00059 namespace Poco { 00060 00061 00062 class Foundation_API SharedLibrary: private SharedLibraryImpl 00065 { 00066 public: 00067 SharedLibrary(); 00069 00070 SharedLibrary(const std::string& path); 00073 00074 virtual ~SharedLibrary(); 00077 00078 void load(const std::string& path); 00084 00085 void unload(); 00087 00088 bool isLoaded() const; 00090 00091 bool hasSymbol(const std::string& name); 00094 00095 void* getSymbol(const std::string& name); 00101 00102 const std::string& getPath() const; 00106 00107 static std::string suffix(); 00112 00113 private: 00114 SharedLibrary(const SharedLibrary&); 00115 SharedLibrary& operator = (const SharedLibrary&); 00116 }; 00117 00118 00119 } // namespace Poco 00120 00121 00122 #endif // Foundation_SharedLibrary_INCLUDED