It is not entirely clear what the functions and especially what their signatures are in that C library clibsmi.
In general, for shared libraries, you need to define those first as prototype using ctypes.CFUNCTYPE() and then instantiate each prototype once supplying the necessary parameter flags using prototype(func_spec, tuple_of_param_flags). See sections 15.16.2.3 and 4 of the ctypes docs*. Take a look the Python bindings** for the VLC library, the file called vlc.py***. The function _Cfunction is used to create the Python callable for each C function in that VLC library. All the Python callables are in the second half of the vlc.py file, starting at line 2600. Hope this helps, /Jean *) <http://docs.python.org/library/ctypes.html#foreign-functions> **) <http://wiki.videolan.org/Python_bindings> ***) <http://git.videolan.org/?p=vlc/bindings/ python.git;a=tree;f=generated;b=HEAD> On Dec 10, 3:32 pm, News Wombat <newswom...@gmail.com> wrote: > Hi everyone, > > I've been experimenting with the ctypes module and think it's great. > I'm hitting a few snags though with seg faults. I attached two links > that holds the code. The line i'm having problems with is this, > > sn=clibsmi.smiGetNextNode(pointer(sno),SMI_NODEKIND_ANY) > > It will work one time, and if I call it again with the result of the > previous, even though the result (a c struct) looks ok, it will > segfault. I think it's a problem with pointers or maybe the function > in the c library trying to change a string that python won't let it > change. I'm stuck, any tips would be appreciated. Thanks, and Merry > Christmas! > > constants.py:http://pastebin.com/HvngjzZN > libsmi.py:http://pastebin.com/19C9kYEa -- http://mail.python.org/mailman/listinfo/python-list