[ctypes-users] Problems with c_double pointer
Brought to you by:
theller
|
From: Antti <ant...@he...> - 2005-08-26 09:03:30
|
Hi everybody! I'm having some problems calling a C DLL from python. I have two almost=20 similar functions in the DLL, that I'm calling. The otherone works just=20 fine and the other doesn't. This is the first function (C header): int Diameter_distribution_pine_Weibull_Mykkanen ( double BA, double DgM,=20 double DIAM_CLASS_WIDTH, double max_class_count, int *nres, struct=20 diamclass *dist, char *warnings, char *errors) ; The struct is my own struct that contains two doubles. The last for=20 arguments are pointers, because the DLL sets values for the arguments and= I=20 use those values in the python later on. This is the second function: double Height_pine_Veltheim (double d, double Age, double BA, double DgM,= =20 double TS, double ALT, int SC, int *nres, double *modelresult, char=20 *warnings, char *errors); The only difference to the first function is the 3rd last=20 argument 'modelresult'. When i call the functions from python, i use c_int and byref() fro the=20 integer pointer, (c_double * 60)() for my own struct and=20 create_string_buffer for the char pointers. This way the first function works and I can get proper values from the=20 pointer arguments. The second function gives "WindowsError: exception:=20 access violation writing 0x40080000" when I try to execute it on WingIDE. Am I missing something here or what? -Antti M=E4kinen |