1👍
✅
Before everything, check [SO]: C function called from Python via ctypes returns incorrect value (@CristiFati’s answer) for a common pitfall when working with CTypes (calling functions).
If your C# function header is correct, here’s how it should look in Python (although an instance of type byte and a value of 0 doesn’t look right to me):
import ctypes as cts
# ...
IntPtr = cts.POINTER(cts.c_int)
ShortPtr = cts.POINTER(cts.c_short)
fr_get_fire_img = fire_dll.fr_get_fire_img
fr_get_fire_img.argtypes = (cts.c_ubyte, ShortPtr, ShortPtr, ShortPtr)
fr_get_fire_img.restype = IntPtr
instance = 0
h = cts.c_short(0)
w = cts.c_short(0)
step = cts.c_short(0)
res = fr_get_fire_img(instance, cts.byref(w), cts.byref(h), cts.byref(step))
# ...
Source:stackexchange.com