[Kde-bindings] Constructor error with QtRuby redux

Caleb Tennis caleb at gentoo.org
Tue Dec 6 13:43:06 UTC 2005

Here's the issue.  In Ruby 1.8.4, there's a new "rb_obj_respond_to", with
this syntax:

rb_obj_respond_to(VALUE obj, ID id, int priv);

Where 'priv' represents whether to search private methods or not.

rb_respond_to now looks like this:

rb_respond_to(VALUE obj, ID id)
    return rb_obj_respond_to(obj, id, Qfalse);

Thus, objects don't directly "respond" to "initialize" anymore, since it's
a private method.  So, we need to use rb_obj_respond_to in place, and use
a Qtrue to tell it to search private methods.

Problem is, this is only valid > 1.8.3, as far as I can see.  So we'll
need some trickery to make sure it compiles properly.

> Okay, I just ran some debugging with Ruby 1.8.3 and Ruby 1.8.4_pre1 and
> the difference is this:
> in Qt.cpp new_qt:
>    if (rb_respond_to(result, rb_intern("initialize")) != 0) {
>         rb_obj_call_init(result, argc, argv);
>     }
> This never gets called in Ruby 1.8.4_pre1&2.  The "result" object looks
> identical between Ruby versions, though.  Thus, it seems as though the
> catch and throw is happening properly, but the object doesn't know it
> responds to initialize.
> _______________________________________________
> Kde-bindings mailing list
> Kde-bindings at kde.org
> https://mail.kde.org/mailman/listinfo/kde-bindings

More information about the Kde-bindings mailing list