given the following code:
import ctypes
ip="192.168.1.1"
thisdll = ctypes.cdll['aDLL']
thisdll.functionThatExpectsAnIP(ip)
how can I correctly pack this for a DLL that expects it as a c_ulong datatype?
I've tried using:
ip_netFrmt = socket.inet_aton(ip)
ip_netFrmt_c = ctypes.c_ulong(ip_netFrmt)
however, the c_ulong()
method returns an error because it needs an integer.
is there a way to use struct.pack
to accomplish this?