Invoke .NET objects from Ruby

I have a DLL assembly containing some classes I wrote in C#, and I’d
like to be able to use these objects from a Ruby script (not from
a .NET Ruby implementation, but from plain old MRI).

Is this possible?

Bill Atkins wrote:

I have a DLL assembly containing some classes I wrote in C#, and I’d
like to be able to use these objects from a Ruby script (not from
a .NET Ruby implementation, but from plain old MRI).

Is this possible?

This might do it:
http://rubyforge.org/projects/rubyclr/

eg:
http://rbazinet.wordpress.com/2006/03/30/rubyclr-ruby-meets-net/

Dan

Bill Atkins wrote:

I have a DLL assembly containing some classes I wrote in C#, and I’d
like to be able to use these objects from a Ruby script (not from
a .NET Ruby implementation, but from plain old MRI).

Is this possible?

I’m not sure if this is of any use to you, but we have a free control,
The Ruby Connector, which lets you go the other way around - that is,
create an application in .NET and run Ruby simultaneous with it, passing
messages from .NET to Ruby and receiving replies from your Ruby programs
which can then be used in the .NET application…

You can download that here:
http://www.sapphiresteel.com/SapphireSteel-Downloads

best wishes
Huw

SapphireSteel Software
Ruby and Rails In Visual Studio
http://www.sapphiresteel.com

This might do it:
http://rubyforge.org/projects/rubyclr/
Can I use rubyclr to automate .NET GUI application. We are currently
writing a XML-RPC to drive our GUI Classes by writing dummy app over our
application back-end, and just test backend part of the application.
However I would want to drive the application from GUI if possible.

I am aware of autoit and other GUI automation tools, however, it would
be great if there is some native support by .NET which can be used by
using rubyclr.

Any ideas?
Thanks and Regards,
Manish

Bill,
If this is on a windows box, which I’m gonna assume since I dunno how
I’d do this with a real os + mono, just use win32ole to create the
object.

I’ve used several homemade .net classes from vbscript before, and I’ve
played with them in ruby, but only went so far as to see it was
possible.

More or less it’s using it just like any other windows class. I don’t
have any
of my old backups on hand, so I can’t copy out examples, but look at the
ones in the ruby win32ole docs, and look at the [vb/j]script examples on
the msdn site.

–Kyle

Bill Atkins wrote:

I have a DLL assembly containing some classes I wrote in C#, and I’d
like to be able to use these objects from a Ruby script (not from
a .NET Ruby implementation, but from plain old MRI).

Is this possible?

I believe that DotNET provides a COM interface for any DotNET class.
I forget the details; there will be issues with funky data types,
but in general, Win32OLE can get to COM objects.

On Feb 5, 2008 4:19 PM, Clifford H. [email protected] wrote:

I believe that DotNET provides a COM interface for any DotNET class.
I forget the details; there will be issues with funky data types,
but in general, Win32OLE can get to COM objects.

Cliff,
.Net objects can be accessed via the COM interface, and it’s a
good way to use it. The down side (and it’s a really big down side…)
for the COM interface, is that (if I’m recalling this correctly, it’s
been awhile) a non .Net program calling a .Net class has the same
triple call overhead that a .Net app has calling a non .Net class.
Literally there is a three call overhead for each time you call from
one to the other. Not a problem if the class you’re calling is doing
all the heavy lifting, or you need a quick and dirty solution, but
nasty for a lot of things.

–Kyle

On Feb 5, 6:54 am, Daniel L. [email protected] wrote:

Dan

Posted viahttp://www.ruby-forum.com/.

Thanks, that’s perfect.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs