ctypes, accessing uInt32 and pointer to uInt32

Andrew Markebo markebo.a at comhem.se
Tue Nov 16 07:05:40 EST 2004


I am taking the first steps letting python access a c-function in a
.dll-file, but need some help getting it right. WHat am I missing? 

          ---------------------------------
# Trying to access c-code placed in a DLL:
# void __stdcall F_to_C(uInt32 DegF, uInt32 *DegC);

from ctypes import *
Convert_Temp=cdll.LoadLibrary("h:/WorkingWith/PythonDLL/Convert_Temp.dll")
fahr=c_int(52)
deg=c_int()
Convert_Temp.F_to_C(fahr, byref(deg))
cdll.free_library (ConvertTemp)
          ----------------------------------

But the result I get is:

  ValueError: Procedure called with not enough arguments (8 bytes
  missing) or wrong calling convention

on the call to ConvertTemp.

If I set fahr and deg to c_long it runs but I get WindowsError:
exception: access violation writing 0x00000000


           Thank you for reading.. 

                 /Andy

-- 
 All people are equal, but some are more equal that the others
				    - Someone more equal
 But we all are told that we differ??
				    - Me.. 



More information about the Python-list mailing list