Is it possible to generate DLLs?

Hello guys,
we’re looking to adopt IronRuby within our project. It’s been great
to test with since we’re all ex-Ruby and/or ex-Rails guys and this makes
everything simpler. We were able to work with windows forms and we can
do everything we want with it so far without a problem. The one thing
that remains is that we are not allowed to send the actual source files
as they are to the customer. I assume there is a simple way we can do
this, but I can’t find any documentation on that or maybe I missed
something. Is there a way I can turn the ruby classes into DLLs so we
can package them up and ship them? That would pretty much seal the deal
to get IronRuby approved for our project.

thanks,

Bassel

Actually, never mind. Looks like precompilation is not supported yet.
Googling shows they may work on it post 1.0. On the other hand, one of
the developers came up with a workaround that will work for us since our
needs are minimal. We are just going to zip and encrypt for now and we
can unzip and run in memory from a small C# app. Also, if someone
really needs a DLL you can use rubydotnet.

Bassel Samman wrote:

Actually, never mind. Looks like precompilation is not supported yet.
Googling shows they may work on it post 1.0. On the other hand, one of
the developers came up with a workaround that will work for us since our
needs are minimal. We are just going to zip and encrypt for now and we
can unzip and run in memory from a small C# app. Also, if someone
really needs a DLL you can use rubydotnet.

I’ve found it easiest to put Ruby scripts into embedded resources in the
DLL then read them out from there. You can optionally encrypt them as
part of the build process and decrypt them before running them so that
they cannot be spied upon. I use this system a lot (with Ruby.Net, but
it will work fine with IronRuby too).

As an added aid during development, the code that I use to get a
resource ‘foo.rb’ from the DLL will do a quick check on disk at location
<dll_location><dll_name> for a plain-text version of ‘foo.rb’. If it
finds one, it loads it in preference. This way you don’t need to rebuild
the DLL during development - only when ready to release.

Good idea.

However, I’d remove the file check before the production build (use #if
DEBUG or something similar).
Having it on the client computers generates 2 main problems:

  1. Performance - you’re doing one or multiple file system calls in vain.
  2. Security - one can figure out about this little mechanism and put a
    malicious foo.rb file in the correct folder, so your application uses
    and
    executes it.

Thanks for sharing,
Shay.

Shay F. | .NET Technologies Expert | Author of IronRuby Unleashed
|
Sela Technology Center
Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay

If you’ve ever run reflector over a .NET dll, you’ll realise that you’re
pretty much shipping the source to every C# or VB.net app you write -
so going along with this I’d recommend just putting the ruby files in a
zip, renaming the zip to .blah, and calling it a day

Sure :slight_smile: I realise the world of enterprises is not neccessarily the
world of
reason or logic :slight_smile:

At any rate, I remember some vague mentionings on the list about a
platform
abstraction layer and it’s being able to read files directly out of
zips,
which sounds like it would also be useful… was that a silverlight
thing or
am I confused?

Thanks to everyone for their responses. We did something similar and
things seem to be going OK with management. Also, Orion, the whole
point is we can’t just ship source. I agree you can do a lot of things
to get to source from compiled formats, but I don’t want to get into the
whole argument of shipping source just won’t fly in the Enterprise
world. Long story short, I think this would make our life easier and
make it easier to convince management that IronRuby is a viable option.

Orion E. wrote:

Sure :slight_smile: I realise the world of enterprises is not neccessarily the
world of
reason or logic :slight_smile:

At any rate, I remember some vague mentionings on the list about a
platform
abstraction layer and it’s being able to read files directly out of
zips,
which sounds like it would also be useful… was that a silverlight
thing or
am I confused?

Nope, no SilverLight here, just a desktop app with MSCharts, win forms
and a whole lot of IronRuby metaprogramming goodness.

using a zip format blocks you from using it in certain ways like adding
it
as a reference to visual studio.
Nobody says your dll needs to contain just ruby code. It can contain
thin C#
wrappers for example.

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

After 1.0 we’ll be making IronRuby integrate better with its “static”
world. I’m not sure the current state of precompiling, but I’m pretty
sure we’re not even testing it.

~Jimmy

From: [email protected]
[mailto:[email protected]] On Behalf Of Ivan Porto
Carrero
Sent: Sunday, January 24, 2010 11:21 PM
To: [email protected]
Subject: Re: [Ironruby-core] Is it possible to generate DLLs?

using a zip format blocks you from using it in certain ways like adding
it as a reference to visual studio.
Nobody says your dll needs to contain just ruby code. It can contain
thin C# wrappers for example.

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

On Mon, Jan 25, 2010 at 3:04 AM, Bassel Samman
<[email protected]mailto:[email protected]> wrote:
Orion E. wrote:

am I confused?
Nope, no SilverLight here, just a desktop app with MSCharts, win forms
and a whole lot of IronRuby metaprogramming goodness.

Posted via http://www.ruby-forum.com/.


Ironruby-core mailing list
[email protected]mailto:[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core