From: Francis Cianfrocca Date: 2007-07-17T13:39:12+09:00 Subject: Re: C library extension question ------=_Part_76540_4757965.1184647039724 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/16/07, Ryan Davis wrote: > > > > > 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. > > Except that he wants the users to write func_[a-c] in ruby, to be > invoked by C, via c function pointers. It is that last teeny > requirement that I think blows this up. > > > EventMachine does exactly the same thing to invoke user-written event handlers. The reactor core is in C. It calls a C stub that uses rb_funcall to hit Ruby code. EventMachine's HTTP server also does the same thing. The HTTP server is in C but it calls out to user-written Ruby code to fulfill web requests. ------=_Part_76540_4757965.1184647039724--