113 from ctypes
import RTLD_GLOBAL, PyDLL, c_bool, c_char_p, c_int, c_void_p, util
118 class IInterface_p(c_void_p):
120 return "IInterface_p(0x%x)" % (0
if self.value
is None else self.value)
122 self.log = logging.getLogger(
"BootstrapHelper")
123 libname = util.find_library(
"GaudiKernel")
or "libGaudiKernel.so"
124 self.log.debug(
"loading GaudiKernel (%s)", libname)
128 self.lib = gkl = PyDLL(libname, mode=RTLD_GLOBAL)
131 (
"createApplicationMgr", IInterface_p, []),
132 (
"getService", IInterface_p, [IInterface_p, c_char_p]),
133 (
"setProperty", c_bool, [IInterface_p, c_char_p, c_char_p]),
134 (
"getProperty", c_char_p, [IInterface_p, c_char_p]),
135 (
"setOption",
None, [IInterface_p, c_char_p, c_char_p]),
136 (
"ROOT_VERSION_CODE", c_int, []),
139 for name, restype, argtypes
in functions:
140 f = getattr(gkl,
"py_bootstrap_%s" % name)
141 f.restype, f.argtypes = restype, argtypes
144 if name
not in self.__class__.__dict__:
145 setattr(self, name, f)
155 f = getattr(gkl,
"py_bootstrap_fsm_%s" % name)
156 f.restype, f.argtypes = c_bool, [IInterface_p]
157 gkl.py_bootstrap_app_run.restype = c_bool
158 gkl.py_bootstrap_app_run.argtypes = [IInterface_p, c_int]
160 gkl.py_helper_printAlgsSequences.restype =
None
161 gkl.py_helper_printAlgsSequences.argtypes = [IInterface_p]