Closed hanusek closed 4 years ago
First of all, do not use wildcard imports in Python. There are legitimate edge cases where they make sense - but this is not.
Second, there is no need to import anything from zugbruecke.core
. The core contains intentionally undocumented internal APIs.
Your code should approximately look like this:
import zugbruecke as ctypes
from zugbruecke.wintypes import (
HWND, # ctypes.c_void_p
DWORD, # ctypes.c_ulong
LPCSTR, # ctypes.c_char_p
)
dll_path = 'my_path_foo_bar.dll'
dll = ctypes.cdll.LoadLibrary(dll_path) # very likely `cdll` because of `__declspec`
connect = dll.K5DB_Connect
connect.argtypes = (
HWND, # handle of the parent window for callbacks
DWORD, # wished callback message
DWORD, # 1 if self-notifications wished
DWORD, # reserved for extension
LPCSTR, # client name
)
connect.restype = DWORD
Works. Thanks.
Hello. How to bind function?