From: SourceForge.net <no...@so...> - 2012-06-01 17:24:12
|
Bugs item #3530361, was opened at 2012-05-28 17:03 Message generated for change (Comment added) made by qwertie You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=3530361&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: code generation (general) Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: David Piepgrass (qwertie) Assigned to: Nobody/Anonymous (nobody) Summary: Cannot generate a director for just one function Initial Comment: The documentation says "The %feature directive can be applied globally, to specific classes, and to specific methods." But it doesn't work as advertised, e.g. %module(directors="1") DirectorBug // generate a director for just Foo::bar() %feature("director") Foo::bar; struct Foo { virtual void bar(); virtual void baz(); }; With C# as the target, SWIG doesn't appear to generate any director-related code. With Java as the target, SWIG does not generate a director class although it does generate separate "Foo_bar" and "Foo_barSwigExplicitFoo" functions. No warnings/errors are issued. Possibly related to bug 3529601. My SWIG Version: 2.0.6 Compiled with i586-mingw32msvc-g++ [i586-pc-mingw32msvc] Configured options: +pcre ---------------------------------------------------------------------- >Comment By: David Piepgrass (qwertie) Date: 2012-06-01 10:24 Message: I've got a class where with 23 virtual functions and I only want directors for 3 of them. At first I made a %nodirector statement for each of the 20 unwanted functions, but then I thought of an easier workaround. In my header file I do: #ifdef SWIG #define INTERNAL protected #define VIRTUAL_IN_CPP #else #define INTERNAL public #define VIRTUAL_IN_CPP virtual #endif Then instead of "virtual", I use "VIRTUAL_IN_CPP" on the functions for which I don't want directors (and INTERNAL for public members that I don't want wrapped at all). Of course, such a workaround only applies if you can modify the original header files. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=3530361&group_id=1645 |