On Wed, 26 Dec 2007, hemant wrote:

> On Dec 26, 2007 3:05 AM, Dave Thomas <dave / pragprog.com> wrote:
>>
>> On Dec 25, 2007, at 1:31 PM, M. Edward (Ed) Borasky wrote:
>> ...
>
> I am working to make couple of gems (C extensions) compatible with
> Ruby 1.9. I would love to have my patches integrated with upstream
> gems. Do we chase down respective author and make him to fix stuff?
>
> Also, changes aren't going to be compatible. I mean a fix for 1.9 will
> break 1.8 gem. How you deal with that?

Well, one cool thing you can use for the C change is this:

#ifndef RSTRING_PTR
#define RSTRING_PTR(s) (RSTRING(s)->ptr)
#endif
#ifndef RSTRING_LEN
#define RSTRING_LEN(s) (RSTRING(s)->len)
#endif

And then change all the RSTRING(s)->len and RSTRING(s)->ptr on your code. This way it will build/run with any ruby version.

This is the same #define that is used for ruby 1.8.6, so it shall be fine to ruby < 1.8.6.

Cheers,

filipe {
  @             icewall.org
  GPG        1024D/A6BA423E
  Jabber  lautert / jabber.ru
}