title: Python ctypes access violation
body: <p>I'm trying to access a dll from python, following <a href="https://stackoverflow.com/questions/252417/how-can-i-use-a-dll-from-python">this guide</a>. The first function I try and call from the dll seems to work fine, so I must be most of the way there, but the second one gives me an access violation.</p>
  
  <p>Python code:</p>
  
  <pre><code>#create open function
  openProto = ctypes.WINFUNCTYPE( ctypes.c_int, ctypes.c_void_p )
  openParams = ( 1, "handle", 0 ) ,
  open = openProto ( ( "SensorOpen", pm ), openParams )
  
  #create zero function
  zeroProto = ctypes.WINFUNCTYPE( ctypes.c_int, ctypes.c_int )
  zeroParams = ( 1, "handle", 0 ), 
  zero = zeroProto ( ( "SensorZero", pm ), zeroParams )
  
  handle = ctypes.c_int ( 0 )
  status = ctypes.c_int ( 0 )
  open( ctypes.byref(handle) )
  print handle
  zero( handle )
  </code></pre>
  
  <p>The access violation occurs when I call the zero( handle ).</p>
  
  <p>The C++ code that does this is here:</p>
  
  <pre><code>SENSOR_HANDLE   seHandle;  // Sensor handle
  double          power;
  char            buff[80];
  
  // Get handle for sensor
  SensorOpen (&amp;seHandle);
  
  printf ("Sensor connected\nZeroing, please wait...\n");
  while (SensorZero (seHandle) == SENSOR_ZERO_FAILED)
  {
      printf ("Zero failed.\nCheck no power is being applied.\nPress return key to retry  ");
      gets (buff);
  }
  </code></pre>
  
  <p>Where SENSOR_HANDLE is just a <code>typedef</code>'d <code>int</code></p>
  
  <p>Any ideas? I assume it's ok not to do anything with the returned value.</p>