jaeandersson / swig

SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.
http://www.swig.org
Other
23 stars 19 forks source link

class hierarchy no longer correct #95

Closed KrisThielemans closed 2 years ago

KrisThielemans commented 5 years ago

I've been using my own fork but want to switch over to the most recent version. Unfortunately, the generated .m files no longer contain the correct class hierarchy for me, i.e. all classes are just derived from SwigRef, while this was working with my fork.

Our full project is at https://github.com/UCL/STIR but it's a bit too complicated as a test case. I'll try to make a simpler one. However, I first wanted to check if it works for others, and if I'm doing something stupid.

This happens even with non-templated classes.

The Python side is still working of course.

KrisThielemans commented 5 years ago

The test case was a bit on the trivial side. Here's my .i file:

%module testit
%{
#define SWIG_FILE_WITH_INIT
%}

%init %{
%}

%inline %{
struct A
{  int a;
};
struct B: public A
{  int b;
};
%}

command line

swig -matlab -c++  -module testit testit.i

First line of the generated B.m:

classdef B < SwigRef

(should be derived from testit.A of course)

KrisThielemans commented 2 years ago

will be fixed after #96