Python ctypes access violation with const pointer arguments -
i have api i'm trying wrap in python (2.7.6 on win7) code using ctypes. here's api:
client_dllfunc bool clientapi search_exporttoclipcopy(clienthsearch handle, int channel, lpctstr filename, const time_t& from, const time_t& to, const bool* cameras, int length, bool usepassword, lpctstr password, bool includetextin = false, bool excludeplayer = false);
the issue i'm having cameras
argument; , i've had issue other const pointer arguments well. here's how i'm wrapping api:
def search_exporttoclipcopy(self, hsearch, csearch, filename, tfrom, tto, cameras, length, usepassword, password, includetextin=true, excludeplayer=false): exporttoclipcopy = self.sdkdll.search_exporttoclipcopy exporttoclipcopy.argtypes = [c_int, c_int, c_wchar_p, c_long, c_long, pointer(c_bool), c_int, c_bool, c_wchar_p, c_bool, c_bool] exporttoclipcopy.restype = c_bool exporttoclipcopy(hsearch, csearch, filename, tfrom, tto, cameras, length, usepassword, password, includetextin, excludeplayer)
unless i'm missing something, should able call python function arguments of type above, , hit api. that's not happens:
cam_ptr = pointer(c_bool()) search_exporttoclipcopy(hsearch, csearch, 'dltest.exe', 1399387862, 1399388162, (cam_ptr), 32, false, '', true, false)
this result:
exception: access violation reading 0x5368f802
this 1 way i've tried it, among few. i've done exact same thing api same client (albeit different dll), argument non-const bool pointer, , well. doing wrong?
Comments
Post a Comment