title: ctypes and passing a by reference to a function
body: <p>I'm trying to use libpcap in python3 using ctypes. </p>
  
  <p>given the following function in C</p>
  
  <pre><code>pcap_lookupnet(dev, &amp;net, &amp;mask, errbuf)
  </code></pre>
  
  <p>in python I have the following</p>
  
  <pre><code>pcap_lookupnet = pcap.pcap_lookupnet
  
  mask = ctypes.c_uint32
  net = ctypes.c_int32
  
  if(pcap_lookupnet(dev,net,mask,errbuf) == -1):
  print("Error could not get netmask for device {0}".format(errbuf))
  sys.exit(0)
  </code></pre>
  
  <p>and the error i get is </p>
  
  <pre><code>  File "./libpcap.py", line 63, in &lt;module&gt;
   if(pcap_lookupnet(dev,net,mask,errbuf) == -1):
  ctypes.ArgumentError: argument 2: &lt;class 'TypeError'&gt;: Don't know how to convert parameter 2
  </code></pre>
  
  <p>how do you deal with &amp;blah  values ? </p>