Support for parameter passing by value, pointer and reference.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-maciekd@10604 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Maciej Drwal 2008-06-28 20:48:40 +00:00
commit f03e17b405
4 changed files with 45 additions and 13 deletions

View file

@ -10,7 +10,7 @@ public:
int get() { return x; }
};
/*void foo_by_val(Bar bar);
void foo_by_ref(Bar& bar);*/
void foo_by_val(Bar bar);
void foo_by_ref(Bar& bar);
void foo_by_ptr(Bar* bar);

View file

@ -2,10 +2,19 @@
#include "example_proxy.h"
void test(Bar * bar) {
printf("value of x is %d\n", Bar_get(bar));
}
int main(int argc, char** argv) {
Bar * bar = new_Bar();
test(bar);
foo_by_val(bar);
test(bar);
foo_by_ptr(bar);
test(bar);
foo_by_ref(bar);
test(bar);
delete_Bar(bar);
return 0;
}