G
Gin Mendi
Been trying to learn how to use ruby and Ruby/DL and I'm unsure how to
implement this:
I have a callback function in C which I want to implement in ruby
void my_callback(my_struct resultList, DWORD count)
{
while (count != 0)
{
if (resultList != NULL)
{
printf("field1 - %s , field2 - %f \n", resultList->field1,
resultList->field2);
}
resultList++;
count--;
}
}
I started with this:
MY_CALLBACK = DL.callback('0PL') { |result_list, count|
if result_list
record = MyStruct.new(result_list)
puts record.field1
end
}
My problem is I don't know how to get the other records if result_list
points to 2 or more records. I want to be able to traverse the whole set
or records like in the C callback function. I understand that I will
need to loop "count" times but how do I make my pointer point to the
next record?
Thanks for the help
implement this:
I have a callback function in C which I want to implement in ruby
void my_callback(my_struct resultList, DWORD count)
{
while (count != 0)
{
if (resultList != NULL)
{
printf("field1 - %s , field2 - %f \n", resultList->field1,
resultList->field2);
}
resultList++;
count--;
}
}
I started with this:
MY_CALLBACK = DL.callback('0PL') { |result_list, count|
if result_list
record = MyStruct.new(result_list)
puts record.field1
end
}
My problem is I don't know how to get the other records if result_list
points to 2 or more records. I want to be able to traverse the whole set
or records like in the C callback function. I understand that I will
need to loop "count" times but how do I make my pointer point to the
next record?
Thanks for the help