c++ - SWIG support for inheritance of static member functions -


SWIG does not wrap up the stable work in the legacy of derived sections, how can this be resolved?

This is a simple example of this problem.

This is a simple C ++ header file:

  // file Test.hpp #include & lt; Iostream & gt; Square b {public: static zero state () {std :: cerr & lt; & Lt; "=== Static Function B :: State" and lieutenant; & Lt; Std :: endl; } Zero nonstat () const {std :: cerr & lt; & Lt; "==== B: Calling nonstat for some B objects" & lt; & Lt; Std :: endl; }}; Class D: Public B {};  

The C ++ source file contains only the header file:

  // file test.cpp #include "test.hpp"  

The SWIG interface file contains only C ++ header files:

test.wig% module exam% {# # "test.hpp"%} % Included "test .hpp"

Then I generated the swig wrapper code by:

  swig -c ++ -tcl8 -namespace main.swig  

and after that I will create a shared library:

  G ++ - fpic -Wall -pedantic -fno-strict-aliasing \ test.cpp test_wrap .cxx -o libtest.so  

So when one Libcd.loc is loaded in ccl interpreter and trying to use the wrapped interface, then it has the following behavior:

 % load libtest.so test% test :: BB % Exam :: DD% B nonstat # works fine OK% d nonstate # work fine% test :: B_stat # works fine% test :: D_stat # does not work !!  

So the question is how can I swig to wrap D :: stat?

Is static work defined in parent code only? Like:

  D :: State ();  

Is not it worth the right? Why is it that the SWIG does not wrap the function ...

How can you access the function, SWIG allows you to add / hide / add functions to any category, so it It is possible to "fix" the SWIG class to give access to stat () .

Say that the syntax is something like this:

 % expansion D {...}  

Since I touched SWIG It's been a while, so I can say something wrong.


Comments