+ finally fix pointers to member functions in chicken

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7705 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
John Lenz 2005-10-24 03:42:32 +00:00
commit 48f1da1bfc
4 changed files with 80 additions and 0 deletions

View file

@ -12,6 +12,16 @@ class Foo {
public:
Foo(int a) : num(a) {}
int num;
int func1(int a) {
return 2*a*num;
}
int func2(int a) {
return -a*num;
}
int (Foo::*func_ptr)(int);
};
%}
@ -52,3 +62,19 @@ Foo *Bar::global_fptr = NULL;
Foo &Bar::global_fref = init_ref;
Foo Bar::global_fval = Foo(3);
%}
/* member function tests */
%inline %{
int (Foo::*get_func1_ptr())(int) {
return &Foo::func1;
}
int (Foo::*get_func2_ptr())(int) {
return &Foo::func2;
}
int test_func_ptr(Foo *f, int a) {
return (f->*(f->func_ptr))(a);
}
%}