swig or ctypes , under the gun and need help
Diez B. Roggisch
deets at nospam.web.de
Mon Aug 25 19:15:46 EDT 2008
Sells, Fred schrieb:
> Diez wrote...
>> I don't know swig, but if all you have is a real C-API, try &
>> use ctypes.
>> It's much easier to create bindings for, keeps you fully in
>> the warm and
>> cozy womb of python programming and doesn't need no
>> compilation to create
>> the actual binding.
>>
> You're right the ctypes does seem more pythonesque; however I'm still stuck trying return all these parameters
> that the c api uses. my ctypes code is below. It just quits running when I try to print
> one of the args I did a pass byref on, no error out, nothing. admittedly I'm a newbie to ctypes and not much of a c programmer
> but I could sure use some help. my ctypes test code follows...
>
> from ctypes import *
>
> '''
> create shared object file like so.
> gcc -shared -o rug520.so rug520.c
You need to create a proper library. The above doesn't do that - it
creates as simple object file.
I don't know how to really do that without using autoconf/automake.
Diez
More information about the Python-list
mailing list