ATLAS Offline Software
Loading...
Searching...
No Matches
AthDsoUtils.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5*/
6
11// note: This, I believe, should be part of Reflex::SharedLibrary
12
13// STL includes
14#include <string.h>
15#include <string>
16
17#include "GaudiKernel/System.h"
19
20namespace Athena {
21namespace DsoUtils {
22
23inline
24std::string
25libNativeName( const std::string& libName )
26{
27#if defined(_WIN32)
28 return libName+".dll";
29#elif defined(__linux) || defined(__APPLE__)
30 return "lib"+libName+".so";
31#else
32 // variant of the GIGO design pattern
33 return libName;
34#endif
35}
36
37static
38std::string
40{
41 const char *lib = mem.GetSharedLibs();
42 return lib? lib : "";
43}
44
45bool
47 const std::string& dsoname )
48{
49#ifdef _WIN32
50 char sep = '\\';
51#else
52 char sep = '/';
53#endif
54
55 std::string srcname = dsoName(mem);
56 if (srcname.empty()) {
57 // we do not know the name of the library, let's guess it's OK
58 return true;
59 }
60
61 std::string::size_type pos = dsoname.find_last_of(sep);
62 std::string curname;
63 if (std::string::npos == pos) {
64 curname = dsoname;
65 } else {
66 curname = dsoname.substr(pos+1);
67 }
68
69 return srcname == curname;
70}
71
72} // end namespace DsoUtils
73
74} // end namespace Athena
75
76
TMemberAdapter RootDataMember
Definition RootType.h:208
const char * GetSharedLibs() const
Definition RootType.cxx:212
static std::string dsoName(const RootDataMember &mem)
std::string libNativeName(const std::string &libName)
bool inDso(const RootDataMember &mem, const std::string &dsoname)
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....