logo       

[Newbie]:swig wrappers for bootstrapped classes: msg#00181

programming.swig

Subject: [Newbie]:swig wrappers for bootstrapped classes

In a swig interface file (sample.i), I need to have
the code similar to the following. To understand the
scenario, please go through the comments also:
=========sample.i=============
....
....
class x
{
....
}

%extend x
{
y __getitem__(...) /* since class y is defined later, I get the error*/
{
return y(self, ...);
}
}
%inline
%{
....
class y
{
public:
....
y(x *ptr,...):_ptr(ptr)
{}
/* constructor of class y having x *ptr as one parameter*/
/* You can not cut and paste class y before class x because in that
case, class x is not defined. */
....
}
%}
=========sample.i=============
When I compile the generated sample_wrap.cpp, I get the
compilation error similar to the following:

-----------------------------------
bkcore_wrap.cpp:710: syntax error before `('
bkcore_wrap.cpp: In function `PyObject *_wrap_x___getitem__
(PyObject *, PyObject *)':
bkcore_wrap.cpp:3981: `x___getitem__' undeclared (first use this
function)
bkcore_wrap.cpp:3981: (Each undeclared identifier is reported only once
for each function it appears in.)
-----------------------------------

The above problem used to work with swig 1.1p5. Breaks with
swig 1.3.17.

I tried placing "class x", "class y" and "extend x" at different
places in sample.i, but without any luck.

Any idea how to sort this problem out?

Regards,
sharma K M

Attachment: InterScan_Disclaimer.txt
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise