<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Passing Curiosity: Posts tagged ffi</title>
    <link href="https://passingcuriosity.com/tags/ffi/ffi.xml" rel="self" />
    <link href="https://passingcuriosity.com" />
    <id>https://passingcuriosity.com/tags/ffi/ffi.xml</id>
    <author>
        <name>Thomas Sutton</name>
        
        <email>me@thomas-sutton.id.au</email>
        
    </author>
    <updated>2012-08-18T00:00:00Z</updated>
    <entry>
    <title>PyconAU 2012: Unexpected Day</title>
    <link href="https://passingcuriosity.com/2012/unexpected-day/" />
    <id>https://passingcuriosity.com/2012/unexpected-day/</id>
    <published>2012-08-18T00:00:00Z</published>
    <updated>2012-08-18T00:00:00Z</updated>
    <summary type="html"><![CDATA[<pre><code>import ctypes
import ctypes.util

# Open the SO
libpcap_name = ctypes.util.find_library('pcap')
libpcap = ctypes.CDLL(libpcap_name)

# Start capturing
errbuf = ctypes.create_string_buffer(256)
handle = libpcap.pcal_open_live(&quot;any&quot;, 65535, 0, 0, errbuf)

# Check the error
errbuf.value == 'socket: Operation not permitted'


# Add properties on the function
# .errcheck = function
# .argtypes = [...]
# .restype = ...

class c_timecal(ctypes.Structure):
  _fields = [
    (&quot;tv_sec&quot;, ctypes.c_ulong),
    (&quot;tv_usec&quot;, ctypes.c_ulong),
  ]</code></pre>]]></summary>
</entry>

</feed>
