ATLAS Offline Software
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 601 of file SealSharedLib.cxx.

602  : m_handle (handle)
603 { 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 607 of file SealSharedLib.cxx.

608 { 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 639 of file SealSharedLib.cxx.

640 {
641  assert (m_handle);
642  m_handle = 0;
643  delete this;
644 }

◆ 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 654 of file SealSharedLib.cxx.

655 {
656  assert (! name.empty ());
657  assert (m_handle);
658  std::string mangled = mangle ? symname (name) : name;
659  Data symbol = 0;
660 
661 #if HAVE_DLOPEN || HAVE_LOAD
662  // See comments in "self()" about crashes in dlerror().
663  const char *error = 0;
664  symbol = ::dlsym (m_handle, mangled.c_str ());
665  if (! symbol && (error = ::dlerror ()) != 0)
666  throw SharedLibraryError ("dlsym()", error);
667 
668 #elif HAVE_SHL_LOAD
669  shl_t handle = (shl_t) m_handle;
670  if (::shl_findsym (&handle, mangled.c_str (), TYPE_DATA, &symbol) != 0)
671  throw SharedLibraryError ("shl_findsym()", errno);
672  assert (handle == (shl_t) m_handle);
673 
674 #elif defined _WIN32
675  if (! (symbol = (Data)::GetProcAddress((HINSTANCE)m_handle, mangled.c_str())))
676  throw SharedLibraryError ("GetProcAddress()", GetLastError ());
677 #else
678  // cannot get here---`load' and `self' should take care of it.
679  assert (false);
680 #endif
681  return symbol;
682 }

◆ 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 692 of file SealSharedLib.cxx.

693 {
694  assert (! name.empty ());
695  assert (m_handle);
696  std::string mangled = mangle ? symname (name) : name;
697  Function symbol = 0;
698 
699 #if HAVE_DLOPEN || HAVE_LOAD
700  // See comments in "self()" about crashes in dlerror().
701  const char *error = 0;
702  union { Function func; Data data; } sym;
703  sym.data = ::dlsym (m_handle, mangled.c_str ());
704  if (! sym.data && (error = ::dlerror ()) != 0)
705  throw SharedLibraryError ("dlsym()", error);
706  symbol = sym.func;
707 
708 #elif HAVE_SHL_LOAD
709  shl_t handle = (shl_t) m_handle;
710  if (::shl_findsym (&handle, mangled.c_str (), TYPE_PROCEDURE, &symbol) != 0)
711  throw SharedLibraryError ("shl_findsym()", errno);
712  assert (handle == (shl_t) m_handle);
713 
714 #elif defined _WIN32
715  if (! (symbol = (Function) ::GetProcAddress ((HINSTANCE) m_handle,
716  mangled.c_str ())))
717  throw SharedLibraryError ("GetProcAddress()", GetLastError ());
718 #else
719  // cannot get here---`load' and `self' should take care of it.
720  assert (false);
721 #endif
722  return symbol;
723 }

◆ 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 192 of file SealSharedLib.cxx.

193 {
194 #ifdef _WIN32
195  return name + ".dll";
196 #elif defined __hpux
197  return "lib" + name + ".sl";
198 #else
199  return "lib" + name + ".so";
200 #endif
201 }

◆ 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 255 of file SealSharedLib.cxx.

256 {
257  assert(! name.empty ());
258 
259  void *handle = 0;
260 
261 #if HAVE_DLOPEN || HAVE_LOAD
262 # ifndef RTLD_GLOBAL
263 # define RTLD_GLOBAL 0
264 # endif
265  // See comments in "self()" about crashes in dlerror().
266  if (! (handle = ::dlopen (name.c_str (), RTLD_LAZY | RTLD_GLOBAL)))
267  {
268  const char *msg = ::dlerror ();
269  msg = msg ? msg : "dynamic linker error message lost!";
270  throw SharedLibraryError ("dlopen()", msg);
271  }
272 
273 #elif HAVE_SHL_LOAD
274  if (! (handle = ::shl_load (name.c_str (), BIND_DEFERRED, 0L)))
275  throw SharedLibraryError ("shl_load()", errno);
276 
277 #elif defined _WIN32
278  if (! (handle = ::LoadLibrary (name.c_str ())))
279  throw SharedLibraryError ("LoadLibrary()", GetLastError ());
280 #else
282 #endif
283 
284  return new SharedLibrary (handle);
285 }

◆ loaded()

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

Iterate and provide information about all currently loaded shared libraries.


Definition at line 290 of file SealSharedLib.cxx.

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

◆ operator=()

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

◆ path()

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

Definition at line 156 of file SealSharedLib.cxx.

157 {
158  const char *pathvar = PATH;
159  const char *path = pathvar ? getenv (pathvar) : 0;
160  return path ? path : "";
161 }

◆ 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 616 of file SealSharedLib.cxx.

617 {
618  assert (m_handle);
619 
620 #if HAVE_DLOPEN || HAVE_LOAD
621  ::dlclose (m_handle);
622 #elif HAVE_SHL_LOAD
623  ::shl_unload ((shl_t) m_handle);
624 #elif defined _WIN32
625  ::FreeLibrary ((HINSTANCE) m_handle);
626 #else
627  // cannot get here---`load' and `self' should take care of it.
628  assert (false);
629 #endif
630 
631  m_handle = 0;
632  delete this;
633 }

◆ 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 220 of file SealSharedLib.cxx.

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

◆ 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 210 of file SealSharedLib.cxx.

211 { 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
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
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:654
index
Definition: index.py:1
Athena::SharedLibrary::SharedLibrary
SharedLibrary(void *handle)
Protected constructor for initialising a library object.
Definition: SealSharedLib.cxx:601
SHLIB_UNSUPPORTED
#define SHLIB_UNSUPPORTED
Definition: SealSharedLib.cxx:77
handler
void handler(int sig)
signal handler
Definition: rmain.cxx:98
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
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:156
lumiFormat.i
int i
Definition: lumiFormat.py:92
ret
T ret(T t)
Definition: rootspy.cxx:260
Athena::SharedLibrary::Function
void(* Function)(void)
Definition: SealSharedLib.h:161
python.Constants.TRUE
bool TRUE
for job options legacy (TODO: get rid of these!) ----------------------—
Definition: Control/AthenaCommon/python/Constants.py:22
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:195
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:210
ElfW
ElfW(Dyn) _DYNAMIC[]
Athena::SharedLibrary::m_handle
void * m_handle
Definition: SealSharedLib.h:197
DeMoScan.index
string index
Definition: DeMoScan.py:362
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:569
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:14