This commit is contained in:
cfif 2026-03-25 14:39:06 +03:00
parent 81d1154b8f
commit ffb5ab3646
1 changed files with 10 additions and 21 deletions

View File

@ -86,27 +86,16 @@ class BLFLibrary:
if self._loaded:
return True
lib_paths = [
"./libconv.so", # Linux текущая директория
"./libconv.dylib", # macOS текущая директория
"./conv.dll", # Windows текущая директория
os.path.expanduser("~/lib/libconv.so"),
"/usr/local/lib/libconv.so",
"/usr/lib/libconv.so",
# Добавляем пути из LD_LIBRARY_PATH
*[os.path.join(p, "libconv.so") for p in os.environ.get("LD_LIBRARY_PATH", "").split(":") if p]
]
# Укажите полный путь к вашей DLL
dll_path = r".\conv.dll" # или другой путь
for path in lib_paths:
try:
self._lib = ctypes.CDLL(path)
self._loaded = True
self._setup_functions()
return True
except OSError:
continue
raise RuntimeError("Could not load BLF library. Please build it first.")
try:
self._lib = ctypes.CDLL(dll_path)
self._loaded = True
self._setup_functions()
return True
except OSError as e:
raise RuntimeError(f"Could not load BLF library from {dll_path}: {e}")
def _setup_functions(self):
"""Настройка типов функций"""
@ -328,7 +317,7 @@ class BLFWriter:
return result == 0
def add_lin_send_error(self, channel: int, lin_id: int, dlc: int,
timestamp_ns: int) -> bool:
timestamp_ns: int) -> bool:
"""
Добавить ошибку отправки LIN