Re: Warning 303: %extend defined for an undeclared class opencascade::handle.
Kustaa Nyholm <[email protected]>
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <[email protected]> |
> On 27 Jul 2020, at 11.18, Kustaa Nyholm <[email protected]> wrote: > > I get the 303 for following, although the test_ball seems to compile fine? > > I just can't figure this out. > > > %{ > #include <Standard_Transient.hxx> > > opencascade::handle<int> test_ball; > > %} > > %extend opencascade::handle > { > > }; > > I've looked into Standard_Transient.hxx and there handle is forward declared as: > > namespace opencascade { > template <class T> class handle; > } > > I cannot seem to find the actual class def for handle though. > > wbr Kusti > Found the actual class def and I think I know how to solve this, but I still not understand why the above does not work. First of all I figure I should be working on class 'Standard_Handle', not handle, but to make it work I need to introduce Standard_Handle to SWIG like this: class Standard_Handle { Standard_Handle()=0; }; %ignore operator Standard_Transient*(); %extend Standard_Handle { operator Standard_Transient* () { return static_cast<Standard_Transient*>(this); } }; And this is because the actual header that contains the declaration is never seen by SWIG cause I'm / the SWIG .i files I'm working on do not feed that/those headers to it, right? The include above is only processed by the C++ compiler. Ok, so above produces no warnings, however it does not fix the actual problem I'm having but I will make an other post of it. wbr Kusti