Passing complex numbers into C++

Andrew Gregory andrew.gregory at npl.co.uk
Tue May 28 05:42:52 EDT 2002


"Achim Domma" <achim.domma at syynx.de> wrote in message news:<actnbm$cth$05$1 at news.t-online.com>...
> Hi,
> 
> do you know boost.python ? (www.boost.org)
> 
> Achim
> 

Achim, many thanks for the suggestion. I will give boost a look some
time. In case anyone else is interested, the code was failing at
Py_BuildValue as result must be passed by reference. The amended
function below works ok.

Andrew.

// **** Wrapper ****
PyObject *wrap_csqr(PyObject *self, PyObject *args)
{
	Py_complex r, result;
	if (!PyArg_ParseTuple(args,"D:csqr", &r)) return NULL;
	result = csqr(r);
    return Py_BuildValue("D",&result);
};



More information about the Python-list mailing list