[C++-sig] pyste - function output parameters
Daniel Wallin
dalwan01 at student.umu.se
Tue Sep 9 00:55:06 CEST 2003
At 23:57 2003-09-08, Nicodemus wrote:
>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.
FWIW, this is possible in luabind with a policy:
def(&foo, pure_out_value(_2))
So I guess this feature might come with boost.langbinding, whenever
that's in a usable state. ;)
---
Daniel Wallin
More information about the Cplusplus-sig
mailing list