so i'm developing a backend using django and i got an image processing step for which i'm using a private c++ .dll developed by my company. i'm using ctypes to load the .dll file and managed to make some of the imported functions work properly. but some functions ("fr_get_fire_img" in this case) doesn't work as expected. i don't know if i am specifying the function's argtypes or the function restype incorrectly and need some guide, thanks in advance!
here's the function signature in c#:
[DllImport(DLL_NAME)]
public static extern IntPtr fr_get_fire_img(byte instance, ref short W, ref short H, ref short step);
here's the python code where i'm trying to use the imported function:
import ctypes
from ctypes import c_char_p as char_pointer
from ctypes import c_short as short
from ctypes import c_void_p as int_pointer
zero = char_pointer(0)
w = short(0)
h = short(0)
step = short(0)
fire_dll.fr_get_fire_img.restype = int_pointer
source = fire_dll.fr_get_fire_img(zero, w, h, step)
print(source, type(source))
and finally this is the error i'm getting from ctypes:
Traceback (most recent call last):
File "PATH OF PYTHON FILE", line 44, in <module>
source = fire_dll.fr_get_fire_img(zero, w, h, step)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: exception: access violation writing 0x0000000000000000
i couldn't find any reference online so i'd appreciate some help or guidance.