Some support for overloading, simplified wrapping of pure C functions, some improvements in argument passing typemaps.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-maciekd@10653 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
125f362852
commit
f585c69d02
4 changed files with 346 additions and 183 deletions
|
|
@ -4,6 +4,13 @@ class A {
|
|||
public:
|
||||
int i;
|
||||
A(int i) : i(i) {}
|
||||
void foo() {
|
||||
}
|
||||
};
|
||||
|
||||
class B : public A {
|
||||
public:
|
||||
B(int i) : A(i) {}
|
||||
};
|
||||
|
||||
class MyClass {
|
||||
|
|
@ -18,7 +25,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void bar(int x, int* px, int* xs[5]) {
|
||||
void bar(int x, int* px, int** xs) {
|
||||
printf("x = %d\n", x);
|
||||
printf("*px = %d\n", *px);
|
||||
int i = 0;
|
||||
|
|
@ -28,5 +35,18 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void foo_1(A& a, A& b) {
|
||||
printf("a.i = %d\n", a.i);
|
||||
printf("b.i = %d\n", b.i);
|
||||
a.i++;
|
||||
b.i++;
|
||||
}
|
||||
|
||||
void foo_2(int& x, double& d) {
|
||||
printf("x = %d d = %f\n", x, d);
|
||||
x++;
|
||||
d++;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
#include "example_proxy.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
MyClass* mc = new_MyClass();
|
||||
A* a = new_A(123), *b = new_A(234), *as[5];
|
||||
int i, j = 321, *js[5];
|
||||
double d = 55.0;
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
as[i] = new_A(20 + i);
|
||||
|
|
@ -18,9 +18,18 @@ int main(int argc, char** argv) {
|
|||
js[i] = 0;
|
||||
|
||||
MyClass_bar(mc, j, &j, js);
|
||||
MyClass_foo(mc, *a, b, as);
|
||||
MyClass_foo(mc, a, b, as);
|
||||
MyClass_foo_1(mc, a, b);
|
||||
MyClass_foo_1(mc, a, b);
|
||||
|
||||
MyClass_foo_2(mc, &j, &d);
|
||||
MyClass_foo_2(mc, &j, &d);
|
||||
|
||||
delete_A(a);
|
||||
delete_A(b);
|
||||
delete_MyClass(mc);
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
delete_A(as[i]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue