76 from ctypes
import (PyDLL, util, c_void_p, c_bool, c_char_p, c_int,
81 class IInterface_p(c_void_p):
83 return "IInterface_p(0x%x)" % (0
if self.value
is None 85 self.
log = logging.getLogger(
'BootstrapHelper')
86 libname = util.find_library(
'GaudiKernel')
or 'libGaudiKernel.so' 87 self.log.debug(
'loading GaudiKernel (%s)', libname)
91 self.
lib = gkl = PyDLL(libname, mode=RTLD_GLOBAL)
93 functions = [(
'createApplicationMgr', IInterface_p, []),
94 (
'getService', IInterface_p, [IInterface_p, c_char_p]),
95 (
'setProperty', c_bool, [
96 IInterface_p, c_char_p, c_char_p]),
97 (
'getProperty', c_char_p, [IInterface_p, c_char_p]),
98 (
'addPropertyToCatalogue', c_bool, [
99 IInterface_p, c_char_p, c_char_p, c_char_p]),
100 (
'ROOT_VERSION_CODE', c_int, []),
103 for name, restype, argtypes
in functions:
104 f = getattr(gkl,
'py_bootstrap_%s' % name)
105 f.restype, f.argtypes = restype, argtypes
108 if name
not in self.__class__.__dict__:
109 setattr(self, name, f)
111 for name
in (
'configure',
'initialize',
'start',
112 'stop',
'finalize',
'terminate'):
113 f = getattr(gkl,
'py_bootstrap_fsm_%s' % name)
114 f.restype, f.argtypes = c_bool, [IInterface_p]
115 gkl.py_bootstrap_app_run.restype = c_bool
116 gkl.py_bootstrap_app_run.argtypes = [IInterface_p, c_int]
118 gkl.py_helper_printAlgsSequences.restype =
None 119 gkl.py_helper_printAlgsSequences.argtypes = [IInterface_p]