使用ctypes库即可
python
import ctypes
import os
def load_sdk_dlls(folder_path):
for file_name in os.listdir(folder_path):
if file_name.endswith(".dll"): # 确保只加载 DLL 文件
dll_path = os.path.join(folder_path, file_name)
try:
dll = ctypes.CDLL(dll_path)
# print(f"Loaded DLL: {file_name}")
except Exception as e:
print(f"Error loading DLL {file_name}: {e}")
# 加载 SDK 文件夹中的所有 DLL 文件
load_sdk_dlls(r'./sdk')