logo       

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

programming.swig

Subject: [Newbie]:swig wrappers for bootstrapped classes

Sharma K M writes:
> 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

[ snip ]

If you are going to do something like this, I strongly recommend
declaring "y" before you use it as a typename. For example:

%{
class y;
%}

class x { };
%extend x {
y __getitem__(...) { ... }
};

This is almost certainly part of the problem (as "y" is used in the
wrapper code before it is defined).

-- Dave
_______________________________________________
Swig maillist - Swig@xxxxxxxxxxxxxxx
http://mailman.cs.uchicago.edu/mailman/listinfo/swig



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

News | FAQ | advertise