469,281 Members | 2,489 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,281 developers. It's quick & easy.

how to pass a file descriptor in a swig module

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


Jul 18 '05 #1
3 2661
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

Jul 18 '05 #2
"kj.kjn" <kj****@wanadoo.fr> 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...example.tar.gz

Pierre
Jul 18 '05 #3
"kj.kjn" <kj****@wanadoo.fr> 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...example.tar.gz

Pierre
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by timothy.williams | last post: by
4 posts views Thread by Bo Peng | last post: by
1 post views Thread by Stou Sandalski | last post: by
10 posts views Thread by Bart Ogryczak | last post: by
2 posts views Thread by levimc | last post: by
3 posts views Thread by Yang | last post: by
reply views Thread by abarun22 | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.