| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- //
- // SharedLibrary_HPUX.cpp
- //
- // $Id: //poco/1.4/Foundation/src/SharedLibrary_HPUX.cpp#2 $
- //
- // Library: Foundation
- // Package: SharedLibrary
- // Module: SharedLibrary
- //
- // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
- // and Contributors.
- //
- // SPDX-License-Identifier: BSL-1.0
- //
- #include "Poco/SharedLibrary_HPUX.h"
- #include <dl.h>
- namespace Poco {
- FastMutex SharedLibraryImpl::_mutex;
- SharedLibraryImpl::SharedLibraryImpl()
- {
- _handle = 0;
- }
- SharedLibraryImpl::~SharedLibraryImpl()
- {
- }
- void SharedLibraryImpl::loadImpl(const std::string& path, int /*flags*/)
- {
- FastMutex::ScopedLock lock(_mutex);
- if (_handle) throw LibraryAlreadyLoadedException(path);
- _handle = shl_load(path.c_str(), BIND_DEFERRED, 0);
- if (!_handle) throw LibraryLoadException(path);
- _path = path;
- }
- void SharedLibraryImpl::unloadImpl()
- {
- FastMutex::ScopedLock lock(_mutex);
- if (_handle)
- {
- shl_unload(_handle);
- _handle = 0;
- _path.clear();
- }
- }
- bool SharedLibraryImpl::isLoadedImpl() const
- {
- return _handle != 0;
- }
- void* SharedLibraryImpl::findSymbolImpl(const std::string& name)
- {
- FastMutex::ScopedLock lock(_mutex);
- void* result = 0;
- if (_handle && shl_findsym(&_handle, name.c_str(), TYPE_UNDEFINED, &result) != -1)
- return result;
- else
- return 0;
- }
- const std::string& SharedLibraryImpl::getPathImpl() const
- {
- return _path;
- }
- std::string SharedLibraryImpl::suffixImpl()
- {
- #if defined(_DEBUG)
- return "d.sl";
- #else
- return ".sl";
- #endif
- }
- } // namespace Poco
|