On Tue, 15 Apr 2003 21:16:55 +0900, nobu.nokad wrote: > At Tue, 15 Apr 2003 20:02:56 +0900, Simon Strandgaard wrote: >> My code is behaving different, when im doing this change: >> >> # (a) >> VALUE self = rb_class_new_instance(a.n, a.argv, klass); >> >> to: >> >> # (b) >> VALUE self = rb_funcall2(klass, rb_intern("new"), a.n, a.argv); >> >> >> What is the difference ??? > > (a) passes the given block but (b) doesn't, in normal case. > >> Problem: with (a) then we cannot inheirit from a SWIG class. >> Solution: with (b) then inheiritance works fine. > How do they work fine or don't? OK. This is what im trying to do. note: "Embed::Redirect" is a SWIG class. > cat test.rb class RubyView < Embed::Redirect def initialize super end def insert repaint end end > If I try instantiate this "RubyView" class with (a), then it doesn't work and Im getting a error from ruby (sorry its converted into a c++exception). EXCEPTION (RUBY): name=cannot invoke ruby-function where=./a.rb:6 class=TypeError message=wrong argument type RubyView (expected Data) backtrace= from ./a.rb:6:in `repaint' from ./a.rb:6:in `insert' If I try instantiate with (b) then everything works (no errors). > And which version of ruby? > ruby -v ruby 1.8.0 (2003-03-03) [i386-freebsd5.0] > -- Simon Strandgaard