help extending a swig wrapped C++ code

Burlen Loring <[email protected]> Tue, 8 Feb 2022 11:21:11 -0800
Newsgroups gmane.comp.programming.swig
Message-ID <[email protected]>
Hi,

I'm working on a library extending a completely separate and independent 
SWIG wrapped C++ library.

In my C++ library which I'm trying to SWIG wrap, I've got 2 use cases of 
classes from the original C++ library. 1. Some of my classes are derived 
from a base class in the original library. 2. some of my classes have 
API that pass pointer of one of the base classes from the original 
library. My use is 2 C++ classes from the original library.

In my .i I use  "%import original_library.i" to bring in the original 
library into my .i SWIG runs and generates C++ file.

The problem I'm having is when compiling the SWIG generated C++ file, 
lot's of classes I'm not explicitly using have SWIG generated functions 
in the generated C++ file, but the headers for these classes are not 
being included. Eg.

65659 static void *_p_svtkBitArrayIteratorTo_p_svtkObjectBase(void *x, 
int *SWIGUNUSEDPARM(newmemory)) {
65660     return (void *)((svtkObjectBase *) (svtkObject 
*)(svtkArrayIterator *) ((svtkBitArrayIterator *) x));
65661 }

svtkBitArrayIterator and svtkArrayIterator are wrapped classes from the 
original library, but I'm not using them, so my .i file doesn't include 
those headers. Of course the original library's .i file has #includes 
for these but SWIG is not propagating them. I don't think these classes 
even need to be known in my library. However, SWIG is including these.

My question: how to get SWIG to propagate the includes for classes it's 
using from the original library? or alternatively only use the classes I 
use?

I tried to come up with a simple reproducer, alas wasn't able to yet.

Thanks
Burlen


_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user