From: Tim Uckun Date: 2006-07-05T13:18:33+09:00 Subject: Re: Ruby and windows. In my case I have an existing infrastructure where a "master" server instantiates a series of activeX dlls and communicates with them via events. The DLLs are now written in VB and I was thinking it would be nice to rewrite them in Ruby. On 5/15/06, Francis Cianfrocca wrote: > >>>It would be really, really nice once the Ruby interpreter is thread safe > :) > Just by way of clarification, are you referring to the fact that Ruby > doesn't share synchronization primitives with the native platform? I've > given that some thought recently and it may be possible to accomplish with a > patch to Ruby's thread.rb. What's the point of it, however? Are you trying > to make it so a container can spin multiple COM threads and each thread can > access Ruby objects without any cooperation from Ruby's interpreter? > > More broadly (and I'm asking this out of curiosity, not tendentiously): > what's the point of being able to write a DLL in Ruby? Are people looking > for the ability to write CLR programs that include components written in a > variety of different languages? And is there some reason to do this apart > from retaining compatibility with already-written stuff? If you did this, > how much of Ruby's metaprogramming would you have to give up, in order to > get a statically-enforceably contract that could be expressed as a COM > interface? I can imagine a more loosely-coupled way of achieving the same > thing. > > Sorry I'm not really contributing anything but more questions with this > post, but I'm trying to understand the questions that have already been > posed. > > On 5/14/06, John Lam wrote: > > > > In principle, this isn't hard to make happen. I could imagine a > > universal delegator approach where you cruft up a generic > > implementation of IDispatch and use Ruby's reflection capabilities to > > find methods to call. The only wierd stuff that you might have to > > worry about is mapping named parameters and marshaling SAFEARRAYS. > > > > The tougher thing is dealing with threading / apartment model > > compatibility. You could probably only make the STA threading model > > work for the generic case of a single STA in a process due to Ruby not > > being thread safe. > > > > In RubyCLR I have to worry about the case where multiple STA threads > > attempt to call into Ruby - my proxies have to disallow the method > > call and raise a CLR exception. > > > > It would be really, really nice once the Ruby interpreter is thread safe > > :) > > > > -John > > http://www.iunknown.com > > > > > >