how to pass a file descriptor in a swig module

Discussion in 'Python' started by kj.kjn, Jul 2, 2003.

  1. kj.kjn

    kj.kjn Guest

    My function func(File * des) is embedded in a module swig.

    I would to know how to call this function from python script and if it's
    necessay

    to declare a typemaps ?

    Thank you
    kj.kjn, Jul 2, 2003
    #1
    1. Advertising

  2. kj.kjn wrote:
    > My function func(File * des) is embedded in a module swig.
    >
    > I would to know how to call this function from python script and if it's
    > necessay
    >
    > to declare a typemaps ?


    Not sure if that helps here, but Python file objects have a function
    called fileno() to return the file number.

    -- Gerhard
    =?ISO-8859-1?Q?Gerhard_H=E4ring?=, Jul 2, 2003
    #2
    1. Advertising

  3. "kj.kjn" <> writes:

    > My function func(File * des) is embedded in a module swig.
    >
    > I would to know how to call this function from python script and if it's
    > necessay
    >
    > to declare a typemaps ?
    >
    > Thank you

    How to wrap call backs is explained here:
    http://www.swig.org/Doc1.3/SWIG.html#n30

    So basically you just need to wrap the C function to an pointer, and pass that
    pointer to swig.

    A simple example is given here:
    http://www.itp.tu-graz.ac.at/~pierre/swig_example.tar.gz

    Pierre
    Pierre Schnizer, Jul 3, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Pye
    Replies:
    2
    Views:
    298
    Tommy Nordgren
    Mar 15, 2007
  2. =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki

    Reading of file by next of map file and by next of file descriptor.

    =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki, Jul 10, 2007, in forum: C++
    Replies:
    1
    Views:
    776
    Alf P. Steinbach
    Jul 10, 2007
  3. Replies:
    1
    Views:
    265
    Gabriel Genellina
    Feb 26, 2008
  4. Michel Lespinasse

    Descriptor leak in python 2.4 subprocess module

    Michel Lespinasse, Aug 28, 2008, in forum: Python
    Replies:
    0
    Views:
    311
    Michel Lespinasse
    Aug 28, 2008
  5. Zhang, Zhenhua
    Replies:
    0
    Views:
    535
    Zhang, Zhenhua
    May 12, 2010
Loading...

Share This Page