Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > ruby 1.9 porting problem

Reply
Thread Tools

ruby 1.9 porting problem

 
 
Jeff Davis
Guest
Posts: n/a
 
      01-01-2008
I am having problems porting my extension to 1.9.

I'm doing something like:

static VALUE my_alloc(VALUE klass)
{
return Data_Wrap_Struct(klass, NULL, my_free, NULL);
}
...
static VALUE my_init(int argc, VALUE *argv, VALUE self)
{
...
Check_Type(self,T_DATA);
DATA_PTR(self) = my_var;
...
}

But on the "Check_Type(self,T_DATA)" I get:
"[BUG] unknown type 0x12".

This worked fine in 1.8. What's the correct way to do this in 1.9?

Regards,
Jeff Davis




 
Reply With Quote
 
 
 
 
Michael Neumann
Guest
Posts: n/a
 
      01-01-2008
Jeff Davis wrote:
> I am having problems porting my extension to 1.9.
>
> I'm doing something like:
>
> static VALUE my_alloc(VALUE klass)
> {
> return Data_Wrap_Struct(klass, NULL, my_free, NULL);
> }
> ...
> static VALUE my_init(int argc, VALUE *argv, VALUE self)
> {
> ...
> Check_Type(self,T_DATA);
> DATA_PTR(self) = my_var;



That generally should work. Have you tried with a non-NULL value in
Data_Wrap_Struct? Have you tried a 0-ary method first?

static VALUE my_init(VALUE self)
{
...
Check_Type(self,T_DATA);
DATA_PTR(self) = my_var;

Regards,

Michael

 
Reply With Quote
 
 
 
 
Jeff Davis
Guest
Posts: n/a
 
      01-01-2008
On Wed, 2008-01-02 at 06:59 +0900, Michael Neumann wrote:
> Jeff Davis wrote:
> > I am having problems porting my extension to 1.9.
> >
> > I'm doing something like:
> >
> > static VALUE my_alloc(VALUE klass)
> > {
> > return Data_Wrap_Struct(klass, NULL, my_free, NULL);
> > }
> > ...
> > static VALUE my_init(int argc, VALUE *argv, VALUE self)
> > {
> > ...
> > Check_Type(self,T_DATA);
> > DATA_PTR(self) = my_var;

>
>
> That generally should work. Have you tried with a non-NULL value in
> Data_Wrap_Struct? Have you tried a 0-ary method first?
>
> static VALUE my_init(VALUE self)
> {
> ...
> Check_Type(self,T_DATA);
> DATA_PTR(self) = my_var;
>


Thank you for the reply. I think I found the problem: I was compiling
the extension against ruby 1.9, but when I ran irb, I was mistakenly
running irb 1.8.

Too many combinations of installations to keep track of when trying to
do portability testing

Regards,
Jeff Davis




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Porting ruby scripts to JRuby Prakash Maria susai Ruby 2 03-03-2009 02:32 PM
porting java methods to ruby Martin Durai Ruby 24 11-22-2007 08:14 AM
porting perl regexp to ruby niklasalverup@hotmail.com Ruby 1 08-08-2006 12:06 PM
Ruby, CSV and PDF / Porting xtopdf to Ruby with PDF::Writer vasudevram Ruby 0 07-25-2006 02:01 PM
Porting Suggestions: Lucene to Ruby; Perl Text::Balanced Mark Wilson Ruby 2 09-25-2003 06:44 PM



Advertisments