This commit is contained in:
2025-12-04 17:07:16 +08:00
parent c2b4df85ea
commit 2d54629624

View File

@@ -1,9 +1,22 @@
import ctypes import ctypes
import os import os
import sys
# Load DLL # Add DLL directory to PATH
dll_path = os.path.join(os.path.dirname(__file__), "libs", "atcore.dll") dll_dir = os.path.join(os.path.dirname(__file__), "libs")
lib = ctypes.CDLL(dll_path, winmode=0) old_path = os.environ.get("PATH", "")
os.environ["PATH"] = dll_dir + os.pathsep + old_path
# Load DLL with stdcall convention
if hasattr(os, "add_dll_directory"):
os.add_dll_directory(dll_dir)
lib = ctypes.windll.LoadLibrary("atcore.dll")
else:
dll_path = os.path.join(dll_dir, "atcore.dll")
lib = ctypes.windll.LoadLibrary(dll_path)
# Restore PATH
os.environ["PATH"] = old_path
# Type definitions # Type definitions
AT_H = ctypes.c_int AT_H = ctypes.c_int