[C++-sig] pyste - function output parameters

Nicodemus nicodemus at globalite.com.br
Mon Sep 8 23:57:25 CEST 2003


Hi Jason!

Jason.Sibthorpe at aculab.com wrote:

>Hi,
>
>Given a c++ function of the form
>
>out_arg1 foo(in_arg, out_arg2) { ... }
>
>I wonder if there is a neat way of provoking
>pyste to generate a wrapper so that out_arg2
>is returned by the corresponding python function.
>
>ie in python
>
>out1, out2 = module.foo(in)
>  
>

Automatically no, you would have to write a wrapper for that (untested):

foo_wrapper = Wrapper('foo_wrapper',
'''
tuple foo_wrapper(in_type in)
{
    out_type2 out2;
    out_type1 out1 = foo(in, out2);
    return make_tuple(out1, out2);
}
''')
foo = Function(...)
set_wrapper(foo, foo_wrapper)

>I believe this is possible in SWIG.
>  
>

I think you have to write a sort-of-wrapper too, but I can be wrong 
about this.

HTH,
Nicodemus.





More information about the Cplusplus-sig mailing list