equal
deleted
inserted
replaced
|
1 from ctypes import CDLL, RTLD_GLOBAL, pointer, c_int, POINTER, c_char, create_string_buffer |
|
2 def TryPreloadXenomai(): |
|
3 """ |
|
4 Xenomai 3 (at least for version <= 3.0.6) do not handle properly dlclose |
|
5 of shared objects whose dlopen did trigger xenomai_init. |
|
6 As a workaround, this pre-loads xenomai libraries that need to be |
|
7 initialized and call xenomai_init once for all. |
|
8 |
|
9 Xenomai auto init of libs MUST be disabled (see --auto-init-solib in xeno-config) |
|
10 """ |
|
11 try: |
|
12 for name in ["cobalt", "modechk", "copperplate", "alchemy"]: |
|
13 globals()[name] = CDLL("lib"+name+".so", mode=RTLD_GLOBAL) |
|
14 cobalt.xenomai_init(pointer(c_int(0)), pointer((POINTER(c_char)*2)(create_string_buffer("prog_name"), None))) |
|
15 except: |
|
16 pass |