From 80fcd98b5c9e8341c79f155eb5867f3549009e36 Mon Sep 17 00:00:00 2001 From: Masaki Fukushima Date: Sun, 13 Aug 2000 13:45:41 +0000 Subject: [PATCH] swig no longer generates delete_* function when no addmethods mode. Deal with it. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@646 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules1.1/ruby.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Source/Modules1.1/ruby.cxx b/Source/Modules1.1/ruby.cxx index 81d38ce7a..06282083e 100644 --- a/Source/Modules1.1/ruby.cxx +++ b/Source/Modules1.1/ruby.cxx @@ -1211,10 +1211,18 @@ void RUBY::cpp_destructor(char *name, char *newname) { Printv(freefunc, "free_", klass->cname, 0); Printv(freeproto, "static void ", freefunc, "(", klass->type, " *);\n", 0); Printv(freebody, "static void\n", - freefunc, "(", klass->type, " *ptr) {\n", - tab4, Swig_name_destroy(name), "(ptr);\n", - "}\n", - 0); + freefunc, "(", klass->type, " *", Swig_cparm_name(0,0), ") {\n", + tab4, 0); + if (AddMethods) { + Printv(freebody, Swig_name_destroy(name), "(", Swig_cparm_name(0,0), ")", 0); + } else { + /* When no addmethods mode, swig emits no destroy function. */ + if (CPlusPlus) + Printv(freebody, Swig_cppdestructor_call(), 0); + else + Printv(freebody, Swig_cdestructor_call(), 0); + } + Printv(freebody, ";\n}\n", 0); if (CPlusPlus) { Insert(freefunc,0,"VOIDFUNC("); Append(freefunc,")");