Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Athena::SharedLibrary Class Reference

Shared library services. More...

#include <SealSharedLib.h>

Collaboration diagram for Athena::SharedLibrary:

Classes

struct  LibraryInfo
 Information about a currently loaded shared library. More...
 

Public Types

typedef void * Data
 
typedef void(* Function) (void)
 
typedef Callback1< const LibraryInfo & > InfoHandler
 

Public Member Functions

void release (void)
 Release a shared library. More...
 
void abandon (void)
 Abandon a library. More...
 
Data data (const std::string &name, bool mangle=true) const
 Locate and return a reference to a data symbol called name. More...
 
Function function (const std::string &name, bool mangle=true) const
 Locate and return a reference to a function symbol called name. More...
 

Static Public Member Functions

static std::string path (void)
 
static void path ATLAS_NOT_THREAD_SAFE (const std::string &path)
 
static std::string libname (const std::string &name)
 Return a shared library name that follows the system conventions for naming shared library. More...
 
static std::string symname (const std::string &name)
 Transform 'extern "C"' symbol name into a name suitable for lookup in a shared library, e.g. More...
 
static SharedLibraryself (void)
 Return a shared library object representing the application itself. More...
 
static SharedLibraryload (const std::string &name)
 Load a shared library and return an object representing it. More...
 
static void loaded (InfoHandler &handler)
 Iterate and provide information about all currently loaded shared libraries. More...
 

Protected Member Functions

 SharedLibrary (void *handle)
 Protected constructor for initialising a library object. More...
 
 ~SharedLibrary (void)
 Protected destructor for cleaning up a library object. More...
 

Private Member Functions

 SharedLibrary (const SharedLibrary &)
 
SharedLibraryoperator= (const SharedLibrary &)
 

Private Attributes

void * m_handle
 

Detailed Description

Shared library services.


Definition at line 157 of file SealSharedLib.h.

Member Typedef Documentation

◆ Data

Definition at line 160 of file SealSharedLib.h.

◆ Function

typedef void(* Athena::SharedLibrary::Function) (void)

Definition at line 161 of file SealSharedLib.h.

◆ InfoHandler

Definition at line 175 of file SealSharedLib.h.

Constructor & Destructor Documentation

◆ SharedLibrary() [1/2]

Athena::SharedLibrary::SharedLibrary ( void *  handle)
protected

Protected constructor for initialising a library object.

The real initialisation happens in load() or self().

Definition at line 587 of file SealSharedLib.cxx.

588  : m_handle (handle)
589 { assert (m_handle); }

◆ ~SharedLibrary()

Athena::SharedLibrary::~SharedLibrary ( void  )
protected

Protected destructor for cleaning up a library object.

The real destruction happens in release() or #abadon().

Definition at line 593 of file SealSharedLib.cxx.

594 { assert (! m_handle); }

◆ SharedLibrary() [2/2]

Athena::SharedLibrary::SharedLibrary ( const SharedLibrary )
private

Member Function Documentation

◆ abandon()

void Athena::SharedLibrary::abandon ( void  )

Abandon a library.

This simply destroys the shared library object (this) without releasing the underlying dynamic object.

Definition at line 625 of file SealSharedLib.cxx.

626 {
627  assert (m_handle);
628  m_handle = 0;
629  delete this;
630 }

◆ ATLAS_NOT_THREAD_SAFE()

static void path Athena::SharedLibrary::ATLAS_NOT_THREAD_SAFE ( const std::string &  path)
static

◆ data()

SharedLibrary::Data Athena::SharedLibrary::data ( const std::string &  name,
bool  mangle = true 
) const

Locate and return a reference to a data symbol called name.

If no such symbol exists, returns a null pointer. If mangle is the default true, the symbol is mangled to the platform convention, typically prepending an underscore if required. The mangling does not refer to C++ name mangling, but to the mangling required to convert C identifiers to run-time symbol names; see symname() for details.

Definition at line 640 of file SealSharedLib.cxx.

641 {
642  assert (! name.empty ());
643  assert (m_handle);
644  std::string mangled = mangle ? symname (name) : name;
645  Data symbol = 0;
646 
647 #if HAVE_DLOPEN || HAVE_LOAD
648  // See comments in "self()" about crashes in dlerror().
649  const char *error = 0;
650  symbol = ::dlsym (m_handle, mangled.c_str ());
651  if (! symbol && (error = ::dlerror ()) != 0)
652  throw SharedLibraryError ("dlsym()", error);
653 
654 #elif HAVE_SHL_LOAD
655  shl_t handle = (shl_t) m_handle;
656  if (::shl_findsym (&handle, mangled.c_str (), TYPE_DATA, &symbol) != 0)
657  throw SharedLibraryError ("shl_findsym()", errno);
658  assert (handle == (shl_t) m_handle);
659 
660 #elif defined _WIN32
661  if (! (symbol = (Data)::GetProcAddress((HINSTANCE)m_handle, mangled.c_str())))
662  throw SharedLibraryError ("GetProcAddress()", GetLastError ());
663 #else
664  // cannot get here---`load' and `self' should take care of it.
665  assert (false);
666 #endif
667  return symbol;
668 }

◆ function()

SharedLibrary::Function Athena::SharedLibrary::function ( const std::string &  name,
bool  mangle = true 
) const

Locate and return a reference to a function symbol called name.

If no such symbol exists, returns a null pointer. If mangle is the default true, the symbol is mangled to the platform convention, typically prepending an underscore if required. The mangling does not refer to C++ name mangling, but to the mangling required to convert C identifiers to run-time symbol names; see symname() for details.

Definition at line 678 of file SealSharedLib.cxx.

679 {
680  assert (! name.empty ());
681  assert (m_handle);
682  std::string mangled = mangle ? symname (name) : name;
683  Function symbol = 0;
684 
685 #if HAVE_DLOPEN || HAVE_LOAD
686  // See comments in "self()" about crashes in dlerror().
687  const char *error = 0;
688  union { Function func; Data data; } sym;
689  sym.data = ::dlsym (m_handle, mangled.c_str ());
690  if (! sym.data && (error = ::dlerror ()) != 0)
691  throw SharedLibraryError ("dlsym()", error);
692  symbol = sym.func;
693 
694 #elif HAVE_SHL_LOAD
695  shl_t handle = (shl_t) m_handle;
696  if (::shl_findsym (&handle, mangled.c_str (), TYPE_PROCEDURE, &symbol) != 0)
697  throw SharedLibraryError ("shl_findsym()", errno);
698  assert (handle == (shl_t) m_handle);
699 
700 #elif defined _WIN32
701  if (! (symbol = (Function) ::GetProcAddress ((HINSTANCE) m_handle,
702  mangled.c_str ())))
703  throw SharedLibraryError ("GetProcAddress()", GetLastError ());
704 #else
705  // cannot get here---`load' and `self' should take care of it.
706  assert (false);
707 #endif
708  return symbol;
709 }

◆ libname()

std::string Athena::SharedLibrary::libname ( const std::string &  name)
static

Return a shared library name that follows the system conventions for naming shared library.

name is the basic name of the shared library, without the name prefix ("lib" on unix) or the extension (".so", ".sl", ".dylib" or ".dll"). name must not have any directory components.

Definition at line 178 of file SealSharedLib.cxx.

179 {
180 #ifdef _WIN32
181  return name + ".dll";
182 #elif defined __hpux
183  return "lib" + name + ".sl";
184 #else
185  return "lib" + name + ".so";
186 #endif
187 }

◆ load()

SharedLibrary * Athena::SharedLibrary::load ( const std::string &  name)
static

Load a shared library and return an object representing it.

The returned object is allocated with new. The caller must release the object with either release() or abandon(). The method throws a #SharedLibraryError if the operation is not supported or some failure occurs. Please note that on several systems failure to properly load a library, e.g. due to missing symbols, is effectively fatal.

Definition at line 241 of file SealSharedLib.cxx.

242 {
243  assert(! name.empty ());
244 
245  void *handle = 0;
246 
247 #if HAVE_DLOPEN || HAVE_LOAD
248 # ifndef RTLD_GLOBAL
249 # define RTLD_GLOBAL 0
250 # endif
251  // See comments in "self()" about crashes in dlerror().
252  if (! (handle = ::dlopen (name.c_str (), RTLD_LAZY | RTLD_GLOBAL)))
253  {
254  const char *msg = ::dlerror ();
255  msg = msg ? msg : "dynamic linker error message lost!";
256  throw SharedLibraryError ("dlopen()", msg);
257  }
258 
259 #elif HAVE_SHL_LOAD
260  if (! (handle = ::shl_load (name.c_str (), BIND_DEFERRED, 0L)))
261  throw SharedLibraryError ("shl_load()", errno);
262 
263 #elif defined _WIN32
264  if (! (handle = ::LoadLibrary (name.c_str ())))
265  throw SharedLibraryError ("LoadLibrary()", GetLastError ());
266 #else
268 #endif
269 
270  return new SharedLibrary (handle);
271 }

◆ loaded()

void Athena::SharedLibrary::loaded ( InfoHandler handler)
static

Iterate and provide information about all currently loaded shared libraries.


Definition at line 276 of file SealSharedLib.cxx.

277 {
278  // Dynamic linker characteristics:
279  // AIX, Windows, SVR4 (DG/UX, DRS/NX, DYNIX/ptx, Linux, SINIX,
280  // Solaris, UnixWare, {Free,Open,Net}BSD if __ELF__), BSD,
281  // HP-UX, IRIX, Tru64
282 
283  // Object file formats:
284  // XCOFF (AIX), ELF32/64 (DG/UX, DRS/NX, DYNIX/ptx, IRIX, SINIX,
285  // Solaris, UnixWare, {Free,Open,Net}BSD: if __ELF__), a.out
286  // ({Free,Open,Net}BSD if ! __ELF__, SunOS), BFD (Cygwin, HP-UX,
287  // Linux, LynxOS, Tru64, Windows if GCC), PE (Windows), COFF (?)
288 
289 #if HAVE_SHL_LOAD // hp-ux
290  shl_descriptor desc;
291 
292  for (int index = -1; shl_get_r (index, &desc) == 0; ++index)
293  {
294  LibraryInfo info;
295  info.m_filename = desc.filename;
296  info.m_text_start = desc.tstart;
297  info.m_text_end = desc.tend;
298  info.m_data_start = desc.dstart;
299  info.m_data_end = desc.dend;
300  info.m_bss_start = 0;
301  info.m_bss_end = 0;
302 
303  handler (info);
304  }
305 
306 #elif HAVE_LINK_H // bsd/svr4/elf
307 # if !HAVE_LINK_MAP_L_MAP_START
308 # define l_map_start l_addr
309 # define l_map_end l_addr
310 # endif
311 # if !HAVE_PROGRAM_INVOCATION_NAME
312  static const char *program_invocation_name = "(unknown program name)";
313 # endif
314 # if HAVE_R_DEBUG // linux/glibc
315  link_map *p = _r_debug.r_map;
316 # else
317  // Dynamic linker root:
318  // BSD (SunOS):
319  // #include <sys/types.h>
320  // #include <link.h>
321  // extern struct link_dynamic _DYNAMIC;
322  // link_dynamic *d = &_DYNAMIC;
323  // if ((d->ld_version > 1) && (d->ld_version <= 3) && (d->ld_un.ld_1 != 0))
324  // --> link_map *l = d->ld_un.ld_1->ld_loaded
325  // l->lm_name, l->lm_addr, l->lm_next
326  //
327  // BSD ({Free,Open,Net}BSD):
328  // #include <sys/types.h>
329  // #include <link.h>
330  // extern struct _dynamic _DYNAMIC
331  // _dynamic *d = &_DYNAMIC;
332  // if ((d->version == LD_VERSION_BSD) && d->d_un.d_sdt != 0))
333  // --> so_map *l = d->d_un.d_sdt->sdt_loaded
334  // l->som_path, l->som_addr, l->som_next
335  //
336  // SVR4 (DG/UX, DRS/NX, DYNIX/ptx, SINIX, UnixWare)
337  // ElfW(Dyn) _DYNAMIC[] // Linux
338  // void _DYNAMIC (void) // weak, really is data, but not
339  // // all compilers allow weak data
340  //
341  // Solaris:
342  // dlinfo (self, RTLD_DI_LINKMAP, &p);
343 
344  // extern ElfW(Dyn) _DYNAMIC []; // #pragma weak? // wlav
345  link_map *p = 0;
346  for (ElfW(Dyn) *dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn)
347  if (dyn->d_tag == DT_DEBUG && dyn->d_un.d_ptr)
348  // linux: p = ((r_debug *) dyn->d_un_d.ptr)->r_map;
349  p = (link_map *) *((unsigned long *) dyn->d_un.d_ptr + 1);
350 # endif
351 
352  if (! p)
353  throw SharedLibraryError ("loaded", "no shared library load map");
354 
355  // Get executable name; linux has a symlink in /proc/self/exe.
356  // Linux path names are arbitrarily long, so we just have create
357  // some random-sized buffer. We allocate this on stack to avoid
358  // dynamic memory allocation. If this is a problem, report a bug.
359  struct stat sbuf;
360  char exe [4096];
361 
362  memset (exe, 0, sizeof (exe));
363  if (::stat ("/proc/self/exe", &sbuf) == 0)
364  ::readlink ("/proc/self/exe", exe, sizeof (exe)-1);
365  else
366  STDC::strncpy (exe, program_invocation_name, sizeof (exe)-1);
367 
368  // Get shared libraries
369  for ( ; p; p = p->l_next)
370  {
371  LibraryInfo info;
372 
373  /* FIXME: Does this work with prelinked shared libraries?
374  From a mail to GCC mailing list ("fde-glibc.c bug"):
375 
376  There is a bug in gcc/config/ia64/fde-glibc.c:
377  ret = find_fde_for_dso ((Elf64_Addr)pc, (Elf64_Ehdr *)map->l_addr,
378  ^^^^^^^^^^^
379  segment_base, gp);
380 
381  this will work only as long as the shared library in
382  question has first PT_LOAD segment's p_vaddr == 0.
383  E.g. with ELF prelinking this is almost never true
384  though, so what you really want is map->l_map_start
385  (map->l_addr will be almost always 0) or even better
386  map->l_phdr/map->l_phnum pair. */
387 
388  // FIXME: use the map address (= ElfW(Ehdr)) to scan over
389  // the different ElfW(Phdr)s to find the various sections.
390  info.m_filename = (p->l_name && p->l_name[0] ? p->l_name : exe);
391  info.m_text_start = p->l_addr ? p->l_addr : p->l_map_start;
392  info.m_text_end = p->l_addr ? p->l_addr : p->l_map_end;
393  info.m_data_start = 0;
394  info.m_data_end = 0;
395  info.m_bss_start = 0;
396  info.m_bss_end = 0;
397 
398  handler (info);
399  }
400 
401 #elif HAVE_SGIDEFS_H // irix
402  /* From rld(1) man page:
403 
404  rld keeps a doubly linked list of structures and crt1.o
405  contains a pointer to the head of the list of obj structures
406  called __rld_obj_head. In an o32 executable, this points to a
407  linked list of objList structures (/usr/include/obj_list.h),
408  each of which has a `data' element which is a pointer to a
409  `struct obj' (/usr/include/obj.h) (even though the field is not
410  declared as a pointer). In an n32 executable, __rld_obj_head
411  points to a linked list of Elf32_Obj_Info structures
412  (/usr/include/objlist.h). In a 64-bit executable,
413  __rld_obj_head points to a linked list of Elf64_Obj_Info
414  structures (/usr/include/objlist.h). The `oi_magic' element of
415  each Elf32_Obj_Info or Elf64_Obj_Info is all-bits-on
416  (0xffffffff) to make it easier to determine which list type is
417  in use a 32-bit executable. */
418 
419  // To get more details by reading the ELF files:
420  // http://reality.sgi.com/davea/software.html
421  extern ElfW(Obj_Info) *__rld_obj_head;
422  ElfW(Obj_Info) *p = __rld_obj_head;
423 
424  for ( ; p; p = (ElfW(Obj_Info) *) p->oi_next)
425  {
426  LibraryInfo info;
427 
428 # if defined _MIPS_SIM_ABI32 && _MIPS_SIM == _MIPS_SIM_ABI32
429  info.m_filename = (const char *) p->o_path;
430  info.m_text_start = p->o_praw; // base address: o_base_address
431  info.m_text_end = p->o_praw;
432 # elif (defined _MIPS_SIM_NABI32 && _MIPS_SIM == _MIPS_SIM_NABI32) \
433  || (defined _MIPS_SIM_ABI64 && _MIPS_SIM == _MIPS_SIM_ABI64)
434  info.m_filename = (const char *) p->oi_pathname;
435  info.m_text_start = p->oi_ehdr; // base address: oi_orig_ehdr
436  info.m_text_end = p->oi_ehdr;
437 # else
438 # error "Unsupported ABI: not o32, n32 or 64"
439 # endif
440  info.m_data_start = 0;
441  info.m_data_end = 0;
442  info.m_bss_start = 0;
443  info.m_bss_end = 0;
444 
445  handler (info);
446  }
447 
448 #elif HAVE_LOADER_H && HAVE_LDR_NEXT_MODULE_DECL // tru64
449  ldr_process_t proc = ldr_my_process ();
450  ldr_module_t mod = LDR_NULL_MODULE;
451  int ret = ldr_next_module (proc, &mod);
452 
453  for (; ret == 0 && mod != LDR_NULL_MODULE; ret = ldr_next_module (proc, &mod))
454  {
455  ldr_module_info_t info;
456  size_t size = 0;
457  LibraryInfo libinfo;
458 
459  if (ldr_inq_module(proc, mod, &info, sizeof(info), &size) < 0)
460  throw SharedLibraryError ("ldr_inq_module()", errno);
461 
462  libinfo.m_filename = info.lmi_name;
463  libinfo.m_text_start = 0;
464  libinfo.m_text_end = 0;
465  libinfo.m_data_start = 0;
466  libinfo.m_data_end = 0;
467  libinfo.m_bss_start = 0;
468  libinfo.m_bss_end = 0;
469 
470  for (int i = 0; i < info.lmi_nregion; ++i)
471  {
472  ldr_region_info_t rinfo;
473  unsigned long low;
474  unsigned long high;
475 
476  if (ldr_inq_region(proc, mod, i, &rinfo, sizeof(rinfo), &size) < 0)
477  throw SharedLibraryError ("ldr_inq_region()", errno);
478 
479  low = (unsigned long) rinfo.lri_mapaddr;
480  high = ((unsigned long) rinfo.lri_mapaddr) + rinfo.lri_size;
481 
482  if (!strcmp(rinfo.lri_name, ".text")) {
483  libinfo.m_text_start = low;
484  libinfo.m_text_end = high;
485  } else if (!strcmp(rinfo.lri_name, ".data")) {
486  libinfo.m_data_start = low;
487  libinfo.m_data_end = high;
488  } else if (!strcmp(rinfo.lri_name, ".bss")) {
489  libinfo.m_bss_start = low;
490  libinfo.m_bss_end = high;
491  }
492  }
493 
494  handler (libinfo);
495  }
496 
497  if (ret < 0)
498  throw SharedLibraryError ("ldr_next_module()", errno);
499 
500 #elif HAVE_LOAD && HAVE_LOAD_DECL // aix
501  int size = 16;
502  void *buffer = new ld_info [size];
503  int error = ::loadquery (L_GETINFO, buffer, size);
504  int offset = 0;
505 
506  while (error == -1 && errno == ENOMEM)
507  {
508  delete [] (ld_info *) buffer;
509  buffer = new ld_info [size *= 2];
510  error = ::loadquery (L_GETINFO, buffer, size);
511  }
512 
513  if (error == -1)
514  throw SharedLibraryError ("loadquery()", errno);
515 
516  while (true)
517  {
518  LibraryInfo info;
519  ld_info *ld = (ld_info *) ((char *) buffer + offset);
520  const char *path = ld->ldinfo_filename;
521  const char *member = path + strlen (path) + 1;
522  std::string filename; // FIXME: Use alloca instead?
523 
524  filename = path;
525  if (*member)
526  {
527  filename += '(';
528  filename += member;
529  filename += ')';
530  }
531 
532  info.m_filename = filename.c_str ();
533  info.m_text_start = (unsigned long) ld->ldinfo_textorg;
534  info.m_text_end = info.m_text_start + ld->ldinfo_textsize;
535  info.m_data_start = (unsigned long) ld->ldinfo_dataorg;
536  info.m_data_end = info.m_data_start + ld->ldinfo_datasize;
537  info.m_bss_start = 0;
538  info.m_bss_end = 0;
539 
540  handler (info);
541 
542  if (ld->ldinfo_next)
543  offset += ld->ldinfo_next;
544  else
545  break;
546  }
547 
548  delete [] (ld_info *) buffer;
549 
550 #elif HAVE_MACH_O_DYLD_H // darwin
551  unsigned long images = _dyld_image_count ();
552  for (unsigned long i = 0; i < images; ++i)
553  {
554  const mach_header *hdr = _dyld_get_image_header (i);
555  unsigned long slide = _dyld_get_image_vmaddr_slide (i);
556  unsigned int size;
557  char *sect;
558  LibraryInfo info;
559 
560  info.m_filename = _dyld_get_image_name (i);
561 
562  sect = getsectdatafromheader (hdr, SEG_TEXT, SECT_TEXT, &size);
563  info.m_text_start = sect ? (unsigned long) sect + slide : 0;
564  info.m_text_end = sect ? (unsigned long) sect + slide + size : 0;
565  sect = getsectdatafromheader (hdr, SEG_DATA, SECT_DATA, &size);
566  info.m_data_start = sect ? (unsigned long) sect + slide : 0;
567  info.m_data_end = sect ? (unsigned long) sect + slide + size : 0;
568  sect = getsectdatafromheader (hdr, SEG_DATA, SECT_BSS, &size);
569  info.m_bss_start = sect ? (unsigned long) sect + slide : 0;
570  info.m_bss_end = sect ? (unsigned long) sect + slide + size : 0;
571 
572  handler (info);
573  }
574 
575 #elif defined _WIN32 // windows
576  if (! SymInitialize (GetCurrentProcess (), NULL, TRUE)
577  || ! SymEnumerateModules (GetCurrentProcess (), &enumModules, (void *) &handler)
578  || ! SymCleanup (GetCurrentProcess ()))
579  throw SharedLibraryError ("SymEnumerateModules()", GetLastError());
580 #else
582 #endif
583 }

◆ operator=()

SharedLibrary& Athena::SharedLibrary::operator= ( const SharedLibrary )
private

◆ path()

std::string Athena::SharedLibrary::path ( void  )
static

Definition at line 148 of file SealSharedLib.cxx.

149 {
150  const char *pathvar = PATH;
151  const char *path = pathvar ? getenv (pathvar) : 0;
152  return path ? path : "";
153 }

◆ release()

void Athena::SharedLibrary::release ( void  )

Release a shared library.

This unloads any library the object currently refers to, then deletes this. Note that releasing the library does not guarantee that it will actually be unloaded. If there are outstanding references to the library, explicit or implicit, the library will remain in memory.

Definition at line 602 of file SealSharedLib.cxx.

603 {
604  assert (m_handle);
605 
606 #if HAVE_DLOPEN || HAVE_LOAD
607  ::dlclose (m_handle);
608 #elif HAVE_SHL_LOAD
609  ::shl_unload ((shl_t) m_handle);
610 #elif defined _WIN32
611  ::FreeLibrary ((HINSTANCE) m_handle);
612 #else
613  // cannot get here---`load' and `self' should take care of it.
614  assert (false);
615 #endif
616 
617  m_handle = 0;
618  delete this;
619 }

◆ self()

SharedLibrary * Athena::SharedLibrary::self ( void  )
static

Return a shared library object representing the application itself.

The returned object is allocated with new. The caller must release the object with either release() or abandon(). The method throws a #SharedLibraryError if the operation is not supported or some failure occurs.

Definition at line 206 of file SealSharedLib.cxx.

207 {
208 #if HAVE_DLOPEN || HAVE_LOAD
209  // NB: Linux (at least RH 7.x) dynamic loader is severely broken
210  // when it comes to reporting error messages. The error messages
211  // are frequently garbled or null. If you see a crash in a call
212  // to dlerror(), sorry, there's nothing we can do about that.
213  // Our attempts have only produced even more undesirable crashes.
214  // Waiting for a better version of the linux dynamic loader.
215  void *handle = ::dlopen (0, RTLD_LAZY);
216  if (! handle)
217  {
218  const char *msg = ::dlerror ();
219  msg = msg ? msg : "dynamic linker error message lost!";
220  throw SharedLibraryError ("dlopen()", msg);
221  }
222 
223  return new SharedLibrary (handle);
224 #elif HAVE_SHL_LOAD
225  return new SharedLibrary (PROG_HANDLE);
226 #elif defined _WIN32
227  return new SharedLibrary (::GetModuleHandle (0));
228 #else
230 #endif
231 }

◆ symname()

std::string Athena::SharedLibrary::symname ( const std::string &  name)
static

Transform 'extern "C"' symbol name into a name suitable for lookup in a shared library, e.g.

with data() or function(). Normally the latter two automatically perform the necessary mangling by calling this function, but the clients can also do the mangling themselves. The name should be in the form it is spelled in C source code.

Definition at line 196 of file SealSharedLib.cxx.

197 { return name; }

Member Data Documentation

◆ m_handle

void* Athena::SharedLibrary::m_handle
private

Definition at line 197 of file SealSharedLib.h.


The documentation for this class was generated from the following files:
grepfile.info
info
Definition: grepfile.py:38
Athena::SharedLibrary::Data
void * Data
Definition: SealSharedLib.h:160
Athena::SharedLibrary::data
Data data(const std::string &name, bool mangle=true) const
Locate and return a reference to a data symbol called name.
Definition: SealSharedLib.cxx:640
jet::ExtendedBool::TRUE
@ TRUE
Definition: UncertaintyEnum.h:234
index
Definition: index.py:1
Athena::SharedLibrary::SharedLibrary
SharedLibrary(void *handle)
Protected constructor for initialising a library object.
Definition: SealSharedLib.cxx:587
SHLIB_UNSUPPORTED
#define SHLIB_UNSUPPORTED
Definition: SealSharedLib.cxx:75
handler
void handler(int sig)
signal handler
Definition: rmain.cxx:99
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
CaloCondBlobAlgs_fillNoiseFromASCII.desc
desc
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:54
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
Athena::SharedLibrary::path
static std::string path(void)
Definition: SealSharedLib.cxx:148
lumiFormat.i
int i
Definition: lumiFormat.py:85
Athena::SharedLibrary::Function
void(* Function)(void)
Definition: SealSharedLib.h:161
beamspotman.stat
stat
Definition: beamspotman.py:266
mc.proc
proc
Definition: mc.PhPy8EG_A14NNPDF23_gg4l_example.py:22
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Athena::SharedLibrary::symname
static std::string symname(const std::string &name)
Transform 'extern "C"' symbol name into a name suitable for lookup in a shared library,...
Definition: SealSharedLib.cxx:196
ElfW
ElfW(Dyn) _DYNAMIC[]
Athena::SharedLibrary::m_handle
void * m_handle
Definition: SealSharedLib.h:197
DeMoScan.index
string index
Definition: DeMoScan.py:364
SCT_ConditionsAlgorithms::CoveritySafe::getenv
std::string getenv(const std::string &variableName)
get an environment variable
Definition: SCT_ConditionsUtilities.cxx:17
PATH
TString PATH
Definition: run_EoverP.cxx:91
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
error
Definition: IImpactPoint3dEstimator.h:70
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
geometry_dat_to_json.ld
ld
Definition: geometry_dat_to_json.py:33