From: Gin Mendi Date: 2009-08-15T13:06:52+09:00 Subject: Re: Ruby/DL question Aaron Patterson wrote: > On Fri, Aug 14, 2009 at 01:43:24PM +0900, Gin Mendi wrote: > > Hmmm. You wouldn't happen to have some sample C code I could compile > and try accessing with DL? > All I have are the compiled DLLs and the callback sample that is called by the function I use that I first posted: 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--; } } which I attempted to translate to: MY_CALLBACK = DL.callback('0PL') { |result_list, count| if result_list record = MyStruct.new(result_list) puts record.field1 end } The C callback works fine. My ruby callback works if count is 1. If it's more than 1 I only end up showing the first record. MyStruct is just a structure full of string, longs, int, and float values. my_struct data type in the C callback is just a pointer for the structure. Is there any other information I can give? -- Posted via http://www.ruby-forum.com/.