printf in python

gianluca geonomica at gmail.com
Wed Jun 4 15:24:55 CEST 2008


On 4 Giu, 03:46, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
> En Tue, 03 Jun 2008 10:28:57 -0300, gianluca <geonom... at gmail.com>
> escribió:
>
>
>
> >> > > On Mon, 2 Jun 2008 00:32:33 -0700 (PDT), gianluca
> >> <geonom... at gmail.com>
> >> > > declaimed the following in comp.lang.python:
>
> >> > > > Hy, I've a problem with may python library generated with swig
> >> from C
> >> > > > code. I works and I can access all function but a  simèple
> >> function
> >> > > > that print a string don't work's.
> >> > > > The function is like this:
> >> > > > int PrintTEST()
> >> > > > {
> >> > > >      printf("TEST ");
> >> > > >      return 1;
> >> > > > }
>
> > I know!! I'm bore!! But I need help indeed!!
> > I'm looking inside lib_wrap.c generated by swig. In the wrap function
> > there is no printf function. If is this the problem how can I do to
> > resolve it?
>
> Generated swig code is... uhm, ugly at least, and rather undebuggable. I'd
> try to avoid it.
> Another alternative is Cython: I've not actually used it myself, but I've
> seen good reports from it.
> If your library is written in C (not C++), you may use directly ctypes
>  from inside Python.
>
> --
> Gabriel Genellina

Yes, I've tried it (ctypes) but I've problems about pointer as
function arguments. I've several truble with it... but I'm working
both in ctypes and swig.
Thank
Gianluca



More information about the Python-list mailing list