- explicitcall feature removed.

- Instead of using the swig_up flag in each director method (Python, Ruby, Ocaml) to indicate
whether the explicit C++ call to the appropriate base class method or a normal
polymorphic C++ call should be made, the new approach makes one of these calls
directly from the wrapper method.
- Java/C# recursive director method calls fixed (no need for explicitcall feature to solve this now)


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9275 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2006-09-13 20:55:24 +00:00
commit f0d1d772fa
12 changed files with 355 additions and 303 deletions

View file

@ -83,7 +83,6 @@
<li><a href="#java_directors_classes">Director classes</a>
<li><a href="#java_directors_overhead">Overhead and code bloat</a>
<li><a href="#java_directors_example">Simple directors example</a>
<li><a href="#java_directors_explicitcall">Director base method calls</a>
</ul>
<li><a href="#common_customization">Common customization features</a>
<ul>
@ -3204,62 +3203,6 @@ directorDerived::upcall_method() invoked.
</pre>
</div>
<H3><a name="java_directors_explicitcall"></a>20.5.5 Director base method calls</H3>
<p>
There is a limitation with Java directors when calling a base class method from an overridden method.
A <tt>java.lang.StackOverflowError</tt> exception will be thrown as the code makes recursive calls from the C++ layer
to the Java layer and back again in the same method. The <a href="SWIGPlus.html#SWIGPlus_explicitcall">explicitcall feature flag</a>
is one way to work around this problem. Consider the following C++ code:
</p>
<div class="code">
<pre>
%feature("director");
%feature("explicitcall");
%include &lt;std_string.i&gt;
%inline %{
struct Thing {
virtual std::string getit() { return "Thing"; }
virtual ~Thing() {}
};
%}
</pre>
</div>
<p>
and the following Java class:
</p>
<div class="code">
<pre>
class JavaThing extends Thing {
public String getit() {
return "Java" + super.getit();
}
}
</pre>
</div>
<p>
The overridden <tt>JavaThing.getit()</tt> method will throw the <tt>java.lang.StackOverflowError</tt> exception when called.
Fixing this would impose a performance penalty on all director methods and would not be able to automatically deal with pure
virtual methods for which a method body is not always defined. Instead, users are advised to use the explicitcall
feature flag which generates an additional method <tt>getitThing()</tt>. The modified version will then avoid the recursive calls:
</p>
<div class="code">
<pre>
class JavaThing extends Thing {
public String getit() {
return "Java" + super.getitThing();
}
}
</pre>
</div>
<H2><a name="common_customization"></a>20.6 Common customization features</H2>