FWCore
PluginManager
src
SharedLibrary.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: PluginManager
4
// Class : SharedLibrary
5
//
6
// Implementation:
7
// <Notes on implementation>
8
//
9
// Original Author: Chris Jones
10
// Created: Thu Apr 5 15:30:15 EDT 2007
11
//
12
13
// system include files
14
#include <string>
/*needed by the following include*/
15
#include <dlfcn.h>
16
#include <cerrno>
17
18
// user include files
19
#include "
FWCore/PluginManager/interface/SharedLibrary.h
"
20
#include "
FWCore/Utilities/interface/Exception.h
"
21
22
namespace
edmplugin
{
23
//
24
// constants, enums and typedefs
25
//
26
27
//
28
// static data member definitions
29
//
30
31
//
32
// constructors and destructor
33
//
34
SharedLibrary::SharedLibrary
(
const
std::filesystem::path
& iName)
35
: libraryHandle_(::dlopen(iName.
string
().c_str(), RTLD_LAZY | RTLD_GLOBAL)),
path_
(iName) {
36
if
(
libraryHandle_
==
nullptr
) {
37
char
const
*
err
= dlerror();
38
if
(
err
==
nullptr
) {
39
throw
cms::Exception
(
"PluginLibraryLoadError"
) <<
"unable to load "
<< iName.string();
40
}
41
throw
cms::Exception
(
"PluginLibraryLoadError"
) <<
"unable to load "
<< iName.string() <<
" because "
<<
err
;
42
}
43
}
44
45
// SharedLibrary::SharedLibrary(const SharedLibrary& rhs)
46
// {
47
// // do actual copying here;
48
// }
49
50
SharedLibrary::~SharedLibrary
() {}
51
52
//
53
// assignment operators
54
//
55
// const SharedLibrary& SharedLibrary::operator=(const SharedLibrary& rhs)
56
// {
57
// //An exception safe implementation is
58
// SharedLibrary temp(rhs);
59
// swap(rhs);
60
//
61
// return *this;
62
// }
63
64
//
65
// member functions
66
//
67
68
//
69
// const member functions
70
//
71
bool
SharedLibrary::symbol
(
const
std::string
& iSymbolName,
void
*& iSymbol)
const
{
72
if
(
libraryHandle_
==
nullptr
) {
73
return
false
;
74
}
75
iSymbol = dlsym(
libraryHandle_
, iSymbolName.c_str());
76
return
(iSymbol !=
nullptr
);
77
}
78
79
//
80
// static member functions
81
//
82
}
// namespace edmplugin
edmplugin
Definition:
AlignmentAlgorithmPluginFactory.cc:9
SharedLibrary.h
edmplugin::SharedLibrary::libraryHandle_
void * libraryHandle_
Definition:
SharedLibrary.h:46
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edmplugin::SharedLibrary::SharedLibrary
SharedLibrary(const std::filesystem::path &iName)
Definition:
SharedLibrary.cc:34
submitPVResolutionJobs.err
err
Definition:
submitPVResolutionJobs.py:85
Exception
Definition:
hltDiff.cc:246
edmplugin::SharedLibrary::~SharedLibrary
~SharedLibrary()
Definition:
SharedLibrary.cc:50
Exception.h
castor_dqm_sourceclient_file_cfg.path
path
Definition:
castor_dqm_sourceclient_file_cfg.py:37
path_
std::string & path_
Definition:
PluginManager.cc:221
edmplugin::SharedLibrary::symbol
bool symbol(const std::string &iSymbolName, void *&iSymbol) const
Definition:
SharedLibrary.cc:71
Generated for CMSSW Reference Manual by
1.8.16