From: William S F. <ws...@fu...> - 2011-09-08 18:48:16
|
On 06/09/11 11:09, REKAPALLI, Prasant wrote: > Hi All, > > I missed a few key things in the last message post. Here is a re-post. > > I have the following class structure in c++ for which I am trying to create a Java interface using SWIG. > > class A > { > virtual double MyFunc(double d); > virtual double MyFunc(MyClass p); > } > > class B : A > { > > } > > class C : B > { > using B::MyFunc; > double MyFunc(MyClass p); > } > > I have the following issue with the Java Interface that is created: > > The Java class created for 'C' contains two definitions for the function 'double MyFunc(MyClass)', each one calling a different static function to JNI. This does not happen with 'double MyFunc(double)' as expected. Any ideas as to why this behaviour is occurring? I am compiling without using directors. > It would help if you posted code that compiled. Here is what I guess you are using: %inline %{ struct MyClass {}; struct A { virtual double MyFunc(double d); virtual double MyFunc(MyClass p); }; struct B : A { }; struct C : B { using B::MyFunc; double MyFunc(MyClass p); }; %} For which I get in C.java: public class C extends B { ... public double MyFunc(double d) { return exampleJNI.C_MyFunc__SWIG_0_0(swigCPtr, this, d); } public double MyFunc(MyClass p) { return exampleJNI.C_MyFunc__SWIG_1(swigCPtr, this, MyClass.getCPtr(p), p); } ... } which looks correct to me. Which version are you using? Try swig-2.0.4. William |