Y
Yuri Danielyan
I'm trying to pass following hash to my c++ ruby extension:
h1 = {"G804988.19" => 0, "G804988.21" => 0, "NH3812.06" => 0,
"NH3812.10" => 0}
myext.SomeFunction(h1)
The hash looks fine from script:
h1.each_pair {| key, value | printf("%s - %s\n", key, value) }
The above statement shows that all 4 hash entries are there.
But in the extension I can only see 3 items.
Code is like below:
extern "C" VALUE SomeFunction(VALUE vSelf,VALUE vh1)
{
struct st_table *pTblHash;
pTblHash = RHASH(vh1)->tbl;
}
The pTblHash->num_entries is correct and equals to 4.
But in the pTblHash->bins array there are only 3 not empty pointers to
hash elements.
If I use one symbol shorter hash keys for one of entries (G80498.21
instead of G804988.21), for example:
h1 = {"G804988.19" => 0, "G80498.21" => 0, "NH3812.06" => 0, "NH3812.10"
=> 0}
then problem disappears.
I'm debugging under Windows XP and Ruby 1.8.
I'll appreciate any help.
Thank you.
Yuri
h1 = {"G804988.19" => 0, "G804988.21" => 0, "NH3812.06" => 0,
"NH3812.10" => 0}
myext.SomeFunction(h1)
The hash looks fine from script:
h1.each_pair {| key, value | printf("%s - %s\n", key, value) }
The above statement shows that all 4 hash entries are there.
But in the extension I can only see 3 items.
Code is like below:
extern "C" VALUE SomeFunction(VALUE vSelf,VALUE vh1)
{
struct st_table *pTblHash;
pTblHash = RHASH(vh1)->tbl;
}
The pTblHash->num_entries is correct and equals to 4.
But in the pTblHash->bins array there are only 3 not empty pointers to
hash elements.
If I use one symbol shorter hash keys for one of entries (G80498.21
instead of G804988.21), for example:
h1 = {"G804988.19" => 0, "G80498.21" => 0, "NH3812.06" => 0, "NH3812.10"
=> 0}
then problem disappears.
I'm debugging under Windows XP and Ruby 1.8.
I'll appreciate any help.
Thank you.
Yuri