From: Tim Uckun Date: 2006-05-15T07:37:56+09:00 Subject: Re: Ruby and windows. My main goal in writing a COM object in Ruby is to be able call rubycode from VB and to replace VB COM objects with ruby COM objects. Rubyis a much more capably language then VB so I would like to use itinstead. 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> >> >>>