[C++-sig] Wrapping out parameter for python access

Chang Chen Chang_Chen at sonic.com
Mon Oct 22 13:08:14 CEST 2007


Hi all

This is a classical issue in boost python. I.e. removeing an argument
from the function definition and adding the "returned", by the original
function, value to the return statement of the function-wrapper

For example :

The original function is:

inline void hello_world( std::string& hw ){
    hw = "hello world!";
}

And the wrapper is:

inline std::string hello_world_wrapper()
{
	std:string temp;
	::hello_world(temp); 
	Return temp;
}

Py++ can help us to generate such wrapper, see
http://language-binding.net/pyplusplus/documentation/functions/transform
ation/built_in/output.html 

But in this thread
(http://mail.python.org/pipermail/c++-sig/2005-June/009097.html ), Dave
provided a start to write a wrapping template.

In My case, only last parameter is out parameter and whether function
parameter count does not matter. The function signature looks like:

Return function (T1 t1, T2 t2, TOUT& out); 

How to write a template for such function and integrate into def?

Any suggestion?

-Chang



More information about the Cplusplus-sig mailing list