# Is it possible to generate DLLs?

**URL:** <https://www.ruby-forum.com/t/is-it-possible-to-generate-dlls/182110>\
**Category:** IronRuby\
**Created:** [January 22, 2010, 7:23pm UTC](https://www.ruby-forum.com/t/is-it-possible-to-generate-dlls/182110 "2010-01-22T19:23:19Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mercedes6s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3be4f8/32.png) [@mercedes6s](https://www.ruby-forum.com/u/mercedes6s)\
**Post date:** [January 22, 2010, 7:23pm UTC](https://www.ruby-forum.com/t/is-it-possible-to-generate-dlls/182110/1 "2010-01-22T19:23:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mercedes6s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3be4f8/32.png) [@mercedes6s](https://www.ruby-forum.com/u/mercedes6s)\
**Post date:** [January 22, 2010, 9:30pm UTC](https://www.ruby-forum.com/t/is-it-possible-to-generate-dlls/182110/2 "2010-01-22T21:30:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mercedes6s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3be4f8/32.png) [@mercedes6s](https://www.ruby-forum.com/u/mercedes6s)\
**Post date:** [January 23, 2010, 1:02pm UTC](https://www.ruby-forum.com/t/is-it-possible-to-generate-dlls/182110/3 "2010-01-23T13:02:51Z")

</div>

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](http://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.

---

<div class="post-metadata">

**Author:** ![mercedes6s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3be4f8/32.png) [@mercedes6s](https://www.ruby-forum.com/u/mercedes6s)\
**Post date:** [January 23, 2010, 3:14pm UTC](https://www.ruby-forum.com/t/is-it-possible-to-generate-dlls/182110/4 "2010-01-23T15:14:52Z")

</div>

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](http://IronShay.com) | Twitter: [http://twitter.com/ironshay](http://twitter.com/ironshay)

---

<div class="post-metadata">

**Author:** ![mercedes6s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3be4f8/32.png) [@mercedes6s](https://www.ruby-forum.com/u/mercedes6s)\
**Post date:** [January 23, 2010, 11:56pm UTC](https://www.ruby-forum.com/t/is-it-possible-to-generate-dlls/182110/5 "2010-01-23T23:56:18Z")

</div>

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](http://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

---

<div class="post-metadata">

**Author:** ![mercedes6s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3be4f8/32.png) [@mercedes6s](https://www.ruby-forum.com/u/mercedes6s)\
**Post date:** [January 24, 2010, 8:29pm UTC](https://www.ruby-forum.com/t/is-it-possible-to-generate-dlls/182110/6 "2010-01-24T20:29:56Z")

</div>

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

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?

---

<div class="post-metadata">

**Author:** ![mercedes6s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3be4f8/32.png) [@mercedes6s](https://www.ruby-forum.com/u/mercedes6s)\
**Post date:** [January 24, 2010, 4:31pm UTC](https://www.ruby-forum.com/t/is-it-possible-to-generate-dlls/182110/7 "2010-01-24T16:31:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mercedes6s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3be4f8/32.png) [@mercedes6s](https://www.ruby-forum.com/u/mercedes6s)\
**Post date:** [January 25, 2010, 3:04am UTC](https://www.ruby-forum.com/t/is-it-possible-to-generate-dlls/182110/8 "2010-01-25T03:04:48Z")

</div>

Orion E. wrote:

> Sure 🙂 I realise the world of enterprises is not neccessarily the  
> world of  
> reason or logic 🙂
> 
> 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.

---

<div class="post-metadata">

**Author:** ![mercedes6s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3be4f8/32.png) [@mercedes6s](https://www.ruby-forum.com/u/mercedes6s)\
**Post date:** [January 25, 2010, 8:26am UTC](https://www.ruby-forum.com/t/is-it-possible-to-generate-dlls/182110/9 "2010-01-25T08:26:49Z")

</div>

## 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](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([IronRuby in Action - Ivan Porto Carrero and Adam Burmister | Manning](http://manning.com/carrero))

---

<div class="post-metadata">

**Author:** ![mercedes6s](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3be4f8/32.png) [@mercedes6s](https://www.ruby-forum.com/u/mercedes6s)\
**Post date:** [January 26, 2010, 9:52am UTC](https://www.ruby-forum.com/t/is-it-possible-to-generate-dlls/182110/10 "2010-01-26T09:52:22Z")

</div>

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: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Ivan Porto  
Carrero  
Sent: Sunday, January 24, 2010 11:21 PM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([IronRuby in Action - Ivan Porto Carrero and Adam Burmister | Manning](http://manning.com/carrero))

On Mon, Jan 25, 2010 at 3:04 AM, Bassel Samman  
\<[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> 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/](http://www.ruby-forum.com/).

* * *

Ironruby-core mailing list  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)
