OUTPUT args from C++ member functions?
<jcupitt <at> gmail.com>
2012-02-03 13:39:29 GMT
Hi all,
I'm having some trouble with output args from C++ member functions in
swig 1.3.40 (the one that comes with current ubuntu).
I have a class like this in a header:
-------
class VImage ... {
...
double test_member( double a, double b, double *c, double *d );
}
--------
With a body like this (ie. it returns three doubles, two via output args):
------
double VImage::test_member( double a, double b, double *c, double *d )
{
*c = a + b;
*d = a - b;
return a * b;
}
--------
In my VImage.i file I have this:
-------
%include "typemaps.i"
extern double vips::VImage::test_member(double INPUT, double INPUT,
double *OUTPUT, double *OUTPUT);
%include VImage.h
------
Looking at the generated code, it seems to have linked up the typemap
with the member, since it includes things like this:
----
res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_double, 0 | 0 );
if (!SWIG_IsOK(res4)) {
----
ie. it's understood that arg4 is a result, but the Python wrapper
still insists on 4 arguments:
print a.test_member(1, 2)
TypeError: VImage_test_member() takes exactly 5 arguments (3 given)
I'm sure I'm being dumb :( Can anyone shed any light on my dumbness?
John
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2