From: Francis Cianfrocca Date: 2007-07-17T11:00:36+09:00 Subject: Re: C library extension question ------=_Part_74762_18660350.1184637631536 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/16/07, Oliver wrote: > > probably I didn't make myself clear: > > Under normal usage, the library expects user to supply some functions > in C, such as func_a(), func_b(), through function pointers defined in > above dispatch command structure. > > Now, from a wrapper stand point of view, I was hoping that the user- > provided function func_a(), func_b() etc. can be done by ruby as well > - it will be very awkward for a user to use partial c, partial ruby > for the same library. I don't see why rb_funcall() can help in this > case - in a sense, this case calls for a way to map ruby function into > C function, for the sake of using the C library call. Write func_a, func_b, func_c as C functions that massage their arguments into Rubyland and call rb_funcall to hit the user-written Ruby functions. Similarly massage the return values from Ruby back into C values. ------=_Part_74762_18660350.1184637631536--