Relocatable Ruby executable

  • Thread starter Asfand Yar Qazi
  • Start date
A

Asfand Yar Qazi

Hi,

How can I create a relocatable Ruby executable? Meaning, that I can
distribute a copy of it along with the modules I need with a binary app I am
embedding Ruby into. I'm considering both actually programatically embedding
Ruby into my app using libruby.a or whatever, as well as making my app an
extension library run by the Ruby executable - if you could give details of
both, I'd be grateful.

Thanks
 
J

Joel VanderWerf

Asfand said:
Hi,

How can I create a relocatable Ruby executable? Meaning, that I can
distribute a copy of it along with the modules I need with a binary app
I am embedding Ruby into. I'm considering both actually programatically
embedding Ruby into my app using libruby.a or whatever, as well as
making my app an extension library run by the Ruby executable - if you
could give details of both, I'd be grateful.

Thanks

Are you aware of rubyscript2exe? It packages the interpreter + libraries
you require + your main script file. I've been very happy with it.

http://www.erikveen.dds.nl/rubyscript2exe/index.html

This is for the ruby extension approach, but not the embedding approach.
 
D

David Vallner

D=C5=88a Streda 08 Febru=C3=A1r 2006 17:33 Asfand Yar Qazi nap=C3=ADsal:
Hi,

How can I create a relocatable Ruby executable? Meaning, that I can
distribute a copy of it along with the modules I need with a binary app I
am embedding Ruby into. I'm considering both actually programatically
embedding Ruby into my app using libruby.a or whatever, as well as making
my app an extension library run by the Ruby executable - if you could give
details of both, I'd be grateful.

Thanks

I -think- on Windows the ruby interpreter semiautomagically sets up the pat=
hs=20
it needs relative to the path where ruby.exe that was run is located, so if=
=20
you can go without the aesthetics and compactness of rubyscript2exe, you=20
should be able to safely get away with distributing your ruby directory alo=
ng=20
in the application's distribution somewhere.

David Vallner
 
A

Asfand Yar Qazi

David said:
Dňa Streda 08 Február 2006 17:33 Asfand Yar Qazi napísal:



I -think- on Windows the ruby interpreter semiautomagically sets up the paths
it needs relative to the path where ruby.exe that was run is located, so if
you can go without the aesthetics and compactness of rubyscript2exe, you
should be able to safely get away with distributing your ruby directory along
in the application's distribution somewhere.

David Vallner

I don't think rubyscript2exe is feasible for a game - think something like
Quake 3 here. But I could be wrong. I would rather have more control over
the files I distribute, that way I can create patches that replace small files
easily - rubyscript2exe I assume bundles everything into a single file that is
unpacked at runtime.

I'll have a look at it though...

But what about when embedding Ruby in my app? How do I handle module paths then?

Thanks
 
M

Matt Mower

But what about when embedding Ruby in my app? How do I handle module pat= hs then?

After initializing the interpreter you can use rb_eval_string() to
execute arbitrary Ruby statements and, for example, setup your library
path by executing (from memory):

rb_eval_string( "$:.clear" );
rb_eval_string( "$: << "my library path" );

Regards,

Matt
 
A

Asfand Yar Qazi

Matt said:
After initializing the interpreter you can use rb_eval_string() to
execute arbitrary Ruby statements and, for example, setup your library
path by executing (from memory):

rb_eval_string( "$:.clear" );
rb_eval_string( "$: << "my library path" );

Regards,

Matt

Ah....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,662
Latest member
salsusa

Latest Threads

Top