From: SourceForge.net <no...@so...> - 2010-04-26 12:04:04
|
Bugs item #2992290, was opened at 2010-04-26 14:04 Message generated for change (Tracker Item Submitted) made by echtler You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2992290&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: Florian Echtler (echtler) Assigned to: Nobody/Anonymous (nobody) Summary: Segfault in managed code when accessing protected methods Initial Comment: Hi, I'm using SWIG 1.3.36 to wrap a rather complex C++ library into Java and C# classes. In both cases, when calling protected methods which have been wrapped with %module (directors="1", allprotected="1") libtisch [...] %feature("director") Widget; I get segfaults in native code when calling any protected method from managed code. However, when I change the C++ header and declare the methods public, it suddenly works without a recompile of the native code - just SWIG has to be re-run. So I suppose this is really a bug in SWIG relating to directors. Florian ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2992290&group_id=1645 |
From: SourceForge.net <no...@so...> - 2011-02-05 15:00:12
|
Bugs item #2992290, was opened at 2010-04-26 12:04 Message generated for change (Comment added) made by wsfulton You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2992290&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: csharp Group: None >Status: Closed >Resolution: Works For Me Priority: 5 Private: No Submitted By: Florian Echtler (echtler) Assigned to: Nobody/Anonymous (nobody) Summary: Segfault in managed code when accessing protected methods Initial Comment: Hi, I'm using SWIG 1.3.36 to wrap a rather complex C++ library into Java and C# classes. In both cases, when calling protected methods which have been wrapped with %module (directors="1", allprotected="1") libtisch [...] %feature("director") Widget; I get segfaults in native code when calling any protected method from managed code. However, when I change the C++ header and declare the methods public, it suddenly works without a recompile of the native code - just SWIG has to be re-run. So I suppose this is really a bug in SWIG relating to directors. Florian ---------------------------------------------------------------------- >Comment By: William Fulton (wsfulton) Date: 2011-02-05 15:00 Message: I cannot replicate using trunk which is the basis for the upcoming swig-2.0.2 release. I'm using the code below. Please test again and if still not working provide a full example that fails. // SWIG interface file %module (directors="1", allprotected="1") example %feature("director") Widget; %inline %{ struct Widget { virtual ~Widget() {} protected: int protectedMethod(int a) { return a; } }; %} // C# test program using System; public class WidgetDotnet : Widget { public int protectedMethod(int a) { int ret = base.protectedMethod(a); return ret * 10; } } public class runme { static void Main() { Console.WriteLine( "starting" ); WidgetDotnet w = new WidgetDotnet(); int a = w.protectedMethod(11); Console.WriteLine("a: {0}", a); Console.WriteLine( "finished" ); } } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2992290&group_id=1645 |