Embedded ruby leaves $: empty

What’s the best way, when embedding Ruby via ruby_init() and such in
C, to give it all the same RUBYPATH style library paths as a ruby.exe
shell call would see?

Where “best” generally means portable to other people’s computers,
where they can be assumed to have a working ruby install of the same
version?

On Sep 6, 4:36 pm, Phlip [email protected] wrote:

What’s the best way, when embedding Ruby via ruby_init() and such in
C, to give it all the same RUBYPATH style library paths as a ruby.exe
shell call would see?

Where “best” generally means portable to other people’s computers,
where they can be assumed to have a working ruby install of the same
version?

Aaaand just a little reading of ruby.c leads us to:

ruby_init_loadpath(); initializes the $: variable ($LOAD_PATH). It
will be initialized with the content of the RUBYLIB unix-environment
variable, plus the location of site_ruby and the current directory.
This path is searched whenever you invoke either require or load.
Therefore is ruby_init_loadpath very necessary if you plan to load
some modules.

http://aeditor.rubyforge.org/ruby_cplusplus/index.html

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