swig/SWIG/Examples/test-suite/overload_extend.i
Marcelo Matus 440d536402 support C/C++ cases, using __cplusplus
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6345 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-06 09:33:28 +00:00

48 lines
697 B
OpenEdge ABL

%module overload_extend
#pragma SWIG nowarn=-302
%extend Foo {
int test() { return 0; }
int test(int x) { x = 0; return 1; }
int test(char *s) { s = 0; return 2; }
#ifdef __cplusplus
int test(double x, double y = 0) { x = 0; y = 0; return 3; }
#else
int test(double x, double y) { x = 0; y = 0; return 3; }
#endif
};
%inline %{
struct Foo {
#ifdef __cplusplus
int test() { return -1; }
#endif
};
%}
%extend Bar {
#ifdef __cplusplus
Bar() {
return new Bar();
}
~Bar() {
if (self) delete self;
}
#else
Bar() {
return (Bar *) malloc(sizeof(Bar));
}
~Bar() {
if (self) free(self);
}
#endif
}
%inline %{
typedef struct {
} Bar;
%}