rb_struct_new example needed

From: jm <jm@...>
Date: 2004-04-29 23:44:25 UTC
List: ruby-core #2834
If I may endulge  in the use of someone's time for a bit. I've narrowed 
a bug in my module down to the following line, tested against ruby 1.6,

rb_struct_aset(rb_vfr_obj, rb_str_new2(FT_XFIELD_ASC_DSTPORT),
                  INT2NUM(tmp32));

I either get

./vftest.rb:57: [BUG] rb_gc_mark(): unknown data type 0x24(0xbffff020) 
non object
ruby 1.6.8 (2002-12-24) [i386-linux-gnu]
Aborted

or

./vftest.rb:57: [BUG] Segmentation fault
ruby 1.6.8 (2002-12-24) [i386-linux-gnu]
Aborted

Depending on how many printf() statements I use for debugging output. 
I'm assuming then that the bug is with the way I'm using rb_struct 
calls as everything else is some what similar to the examples in the 
pickaxe box and that the printf() statements are simply altering the 
timing, hence the change in the errors above.

So I was hoping someone could tell me if the following is valid, after 
calling rb_struct_define with a list of cstrings,

rb_vfr_obj = rb_struct_new(vflowrec, 0);

and then to use rb_struct_aset() as above.

Any pointer in the right direction welcome.

Jeff.


In This Thread

Prev Next