1 // This file tests SWIG pass/return by value for
2 // a class with no default constructor
3
4 %module cpp_nodefault
5
6 %inline %{
7
8 class Foo {
9 public:
10 int a;
Foo(int x,int y)11 Foo(int x, int y) { }
~Foo()12 ~Foo() {}
13 };
14
create(int x,int y)15 Foo create(int x, int y) {
16 return Foo(x,y);
17 }
18
19 typedef Foo Foo_t;
20
consume(Foo f,Foo_t g)21 void consume(Foo f, Foo_t g) {}
22
23 class Bar {
24 public:
consume(Foo f,Foo_t g)25 void consume(Foo f, Foo_t g) {}
create(int x,int y)26 Foo create(int x, int y) {
27 return Foo(x,y);
28 }
29 };
30
31
32 %}
33
34 %{
35 Foo gvar = Foo(3,4);
36 %}
37
38 Foo gvar;
39
40
41