fixes for the nodirector feature and the '0' director member case
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5657 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c2d143e442
commit
9cfb9a490b
6 changed files with 80 additions and 11 deletions
34
Examples/test-suite/frob.i
Normal file
34
Examples/test-suite/frob.i
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
%module(directors="1") frob;
|
||||
|
||||
%header %{
|
||||
#include <iostream>
|
||||
%}
|
||||
|
||||
%feature("director") Alpha;
|
||||
%feature("director") Bravo;
|
||||
|
||||
%feature("nodirector") Bravo::abs_method();
|
||||
|
||||
%inline %{
|
||||
class Alpha
|
||||
{
|
||||
public:
|
||||
Alpha() { }
|
||||
virtual ~Alpha() { };
|
||||
virtual const char* abs_method() = 0;
|
||||
};
|
||||
|
||||
class Bravo : public Alpha
|
||||
{
|
||||
public:
|
||||
Bravo() { }
|
||||
virtual ~Bravo() { };
|
||||
virtual const char* abs_method();
|
||||
};
|
||||
|
||||
const char*
|
||||
Bravo::abs_method()
|
||||
{
|
||||
return "Bravo::abs_method()";
|
||||
}
|
||||
%}
|
||||
24
Examples/test-suite/java/frob_runme.java
Normal file
24
Examples/test-suite/java/frob_runme.java
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
import frob.*;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
public class frob_runme
|
||||
{
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("frob");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String args[])
|
||||
{
|
||||
Bravo foo = new Bravo();
|
||||
|
||||
String s = foo.abs_method();
|
||||
if (!s.equals("Bravo::abs_method()"))
|
||||
throw new RuntimeException( "error" );
|
||||
}
|
||||
}
|
||||
7
Examples/test-suite/python/frob_runme.py
Normal file
7
Examples/test-suite/python/frob_runme.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
from frob import *
|
||||
|
||||
foo = Bravo();
|
||||
s = foo.abs_method();
|
||||
|
||||
if s != "Bravo::abs_method()":
|
||||
raise RuntimeError, s
|
||||
6
Examples/test-suite/ruby/frob_runme.rb
Normal file
6
Examples/test-suite/ruby/frob_runme.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
require 'frob'
|
||||
|
||||
foo = Frob::Bravo.new;
|
||||
s = foo.abs_method;
|
||||
|
||||
raise RuntimeError if s != "Bravo::abs_method()"
|
||||
Loading…
Add table
Add a link
Reference in a new issue