From 440d536402d118d705bdf7b276f59490db84ee43 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Wed, 6 Oct 2004 09:33:28 +0000 Subject: [PATCH] support C/C++ cases, using __cplusplus git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6345 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Examples/test-suite/overload_extend.i | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/SWIG/Examples/test-suite/overload_extend.i b/SWIG/Examples/test-suite/overload_extend.i index 1d61e9752..a892fd9a4 100644 --- a/SWIG/Examples/test-suite/overload_extend.i +++ b/SWIG/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; +%}