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