From: emilie3012@... (Steve Hart) Date: 2003-04-15T10:01:04+09:00 Subject: Re: inheirit from a swig-class "Simon Strandgaard" <0bz63fz3m1qt3001@sneakemail.com> wrote in message news:... > I want to inheirit from a SWIG-class, but I cannot. Why? > Can you help me with this inheiriting problem? > > > If I run the "a.rb" program I get this error message (don't mind the > opfuscated bactrace format :-) > > EXCEPTION (RUBY): > name=cannot invoke ruby-function > where=./a.rb:7 > class=TypeError > message=wrong argument type RubyView (expected Data) > backtrace= from ./a.rb:7:in `repaint' > from ./a.rb:7:in `insert' > > > cat a.rb > class RubyView < Embed::Redirect > def initialize > super > end > def insert > repaint > end > end > > > > > I made this "b.rb" workaround.. and there is no problems. > > > cat b.rb > class RubyView > def initialize > @redir = Embed::Redirect.new > super > end > def insert > @redir.repaint > end > end > > > > > Thanks in advance > Simon Strandgaard Hi Simon, I assumed this was prob with tutorial code. Had a look and got same error. Found if I change the call in NewWrap from: VALUE self = rb_class_new_instance(a.n, a.argv, klass); to: VALUE self = rb_funcall2(klass, rb_intern("new"), a.n, a.argv); it all works. I started looking thru the ruby code but then my brain started to hurt. Would be intersted to know why? Cheers Steve