dll - Python ctypes ValueError - too many arguements? -
i trying access custom dll using ctypes. there several functions inside dll , functions except particular function work when called using windll call procedure.
i created seperate python function wraps around
s = ctypes.windll(r'mydll.dll') def setupoptions(window_area, minimumruntime, igu_flag, innerpanestopflag, mass_1, x_glassfail_1, x_winfail_1, mass_2=0, x_glassfail_2=0, x_winfail_2=0, x_gap=0, maxsteps=10000, maxnumcycles=2, supp_coeff=0.40528, failvelocityfactor=1.0, p_atm=14.7, time_step=0.01, z=0.2, initialstaticload=0.0, x_initial_1=0.0, initial_velocity_1=0.0, x_initial_2=0.0, initial_velocity_2=0.0): # flag identifying whether window igu or not apiiguflag = c_long(igu_flag) apiinnerpanestopflag = c_long(innerpanestopflag) # percentage of critical damping z = c_double(z) # timestep (this can increased - didn't spend time calculate it) time_step = c_double(time_step) # initial conditions initialstaticload = c_double(initialstaticload) x_initial_1 = c_double(x_initial_1) initial_velocity_1 = c_double(initial_velocity_1) x_initial_2 = c_double(x_initial_2) initial_velocity_2 = c_double(initial_velocity_2) # failure values x_glassfail_1 = c_double(x_glassfail_1) x_winfail_1 = c_double(x_winfail_1) x_glassfail_2 = c_double(x_glassfail_2) x_winfail_2 = c_double(x_winfail_2) # environment parameters p_atm = c_double(p_atm) failvelocityfactor = c_double(failvelocityfactor) supp_coeff = c_double(supp_coeff) # other parameters window_area = c_double(window_area) x_gap = c_double(x_gap) # model parameters apimaxsteps = c_long(maxsteps) apimaxnumcycles = c_long(maxnumcycles) mass_1 = c_double(mass_1) mass_2 = c_double(mass_2) minimumruntime = c_double(minimumruntime) return s.api_setupwindowoptions(apiiguflag, apiinnerpanestopflag, z, time_step, initialstaticload, apimaxsteps, apimaxnumcycles, x_initial_1, initial_velocity_1, mass_1, x_glassfail_1, x_winfail_1, x_initial_2, initial_velocity_2, mass_2, x_glassfail_2, x_winfail_2, x_gap, window_area, supp_coeff, p_atm, failvelocityfactor, minimumruntime)
here function called:
area = 2040.0 xgap = 0.5 mass1 = 51.26 mass2 = 51.26 xglassfail1 = 0.970 xglassfail2 = 0.750 xwinfail1 = 0.970 xwinfail2 = 9.18 iguflag = 1 minruntime = 52.0 ret = setupoptions(area, minruntime, iguflag, iguflag, mass1, xglassfail1, xwinfail1, mass2, xglassfail2, xwinfail2, xgap)
i error when run code:
valueerror: procedure called many arguments (8 bytes in excess)
like said, have called several other functions in dll , not had issues. tried using cdll , causes issues (160 bytes short). appreciated have looked @ on , cannot see problem is.
also here function call c++ header file:
mydll_api long _stdcall api_setupwindowoptions(long nisigu, long ninnerpanestopcriteriaonly, double dcritdampingpercent, double dtimestep, double dstaticload, long nmaxsteps, long nmaxnumcycles, double dinitialdisplacementinnerpane, double dinitialvelocityinnerpane, double dmassinnerpane, double dglassfaildeflinnerpane, double dwinfaildeflinnerpane, double dinitialdisplacementouterpane, double dinitialvelocityouterpane, double dmassouterpane, double dglassfaildeflouterpane, double dwinfaildeflouterpane, double dgapsize, double dwindowarea, double dsupportcoefficient, double datmpressure, double dfailvelocityfactor, double dminimumruntime);
Comments
Post a Comment