Re: SWIG and Virtual Inheritance
William S Fulton <[email protected]> Thu, 31 Aug 2023 19:40:15 +0100
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CANGqftDUEUD_xHa4rsg38d7Bffx6RtTnO53TnKPmdk-pqJrXFg@mail.gmail.com> |
Hi Todd
You can expect virtual inheritance to work. We have runtime tests for this
for most target languages. If it doesn't work, it's a bug!
The code you posted seems to parse without problems, I used:
%module example
%inline %{
class A {
public:
virtual ~A() {}
};
class B : public virtual A {
};
%}
Can you modify to show the problem you've got?
The important thing is that the wrappers cast correctly at the C++ layer
and do not assume that a pointer to A has an identical value as a pointer
to B.
William
On Mon, 17 Jul 2023 at 16:09, Todd Hartman <[email protected]> wrote:
> Does SWIG (any version) support virtual inheritance in C++?
> e.g.
>
> class B : public virtual A {
>
> };
>
>
> The documentation for 4.1
> <https://swig.org/Doc4.1/SWIGDocumentation.html#Introduction_nn10>
> doesn't explicitly say. SWIG itself complains about my use of this keyword.
> What would happen if I lied to SWIG about this and just removed "virtual"
> from the header file I feed it? Are there obvious problems that inevitably
> result? What would SWIG do with the knowledge that some classes use this
> kind of inheritance? Does it actually care?
>
>
> todd.
> _______________________________________________
> Swig-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/swig-user
>
_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user