summaryrefslogtreecommitdiff
path: root/Examples/test-suite/overload_extend.i
diff options
context:
space:
mode:
authorMarcelo Matus <mmatus@acms.arizona.edu>2004-10-06 09:33:28 +0000
committerMarcelo Matus <mmatus@acms.arizona.edu>2004-10-06 09:33:28 +0000
commit1db15cece4469505f580d332519bff2abe66aff8 (patch)
tree9b2f8989af0093de6173c07261a826a5e84db2b3 /Examples/test-suite/overload_extend.i
parent11a45c751d857fa8330f50b8bd61caea99c422d7 (diff)
downloadswig-1db15cece4469505f580d332519bff2abe66aff8.tar.gz
support C/C++ cases, using __cplusplus
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6345 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Examples/test-suite/overload_extend.i')
-rw-r--r--Examples/test-suite/overload_extend.i28
1 files changed, 28 insertions, 0 deletions
diff --git a/Examples/test-suite/overload_extend.i b/Examples/test-suite/overload_extend.i
index 1d61e9752..a892fd9a4 100644
--- a/Examples/test-suite/overload_extend.i
+++ b/Examples/test-suite/overload_extend.i
@@ -5,16 +5,44 @@
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;
+%}