Init
This commit is contained in:
parent
81d1154b8f
commit
ffb5ab3646
|
|
@ -86,27 +86,16 @@ class BLFLibrary:
|
||||||
if self._loaded:
|
if self._loaded:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
lib_paths = [
|
# Укажите полный путь к вашей DLL
|
||||||
"./libconv.so", # Linux текущая директория
|
dll_path = r".\conv.dll" # или другой путь
|
||||||
"./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]
|
|
||||||
]
|
|
||||||
|
|
||||||
for path in lib_paths:
|
|
||||||
try:
|
try:
|
||||||
self._lib = ctypes.CDLL(path)
|
self._lib = ctypes.CDLL(dll_path)
|
||||||
self._loaded = True
|
self._loaded = True
|
||||||
self._setup_functions()
|
self._setup_functions()
|
||||||
return True
|
return True
|
||||||
except OSError:
|
except OSError as e:
|
||||||
continue
|
raise RuntimeError(f"Could not load BLF library from {dll_path}: {e}")
|
||||||
|
|
||||||
raise RuntimeError("Could not load BLF library. Please build it first.")
|
|
||||||
|
|
||||||
def _setup_functions(self):
|
def _setup_functions(self):
|
||||||
"""Настройка типов функций"""
|
"""Настройка типов функций"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue