Forum: Ruby Using Tk or Fox with a ruby interpreter embedded in a C appl

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ivan Muzzolini (Guest)
on 2006-01-03 22:28
(Received via mailing list)
Hi! I'm using the ruby interpreter inside a console application written
in C. I compile the C code with the freely downloadable version of the
Microsoft Compiler (Visual C++ Toolkit 2003) and the Ruby182-15 ( the
Windows Installer version).
I'm able to interact with the ruby objects using the Ruby C API and use
several ruby standard modules.
Now, I would like to insert a GUI and use tk or fox. I tried to create
a ruby module BUT the application crashes (the interpreter seems to
crash) when I put the following instructions in a ruby module:

require 'tk'

The same happens if I require 'fox12'. The interpreter doesn't emit any
error message in the standard output; I expected to have some message
because if, for instance, I call a method that is not defined I get a
message in the standard output.
The same ruby module, if launched by the command line using the
ruby.exe program works correctly.

Do you have any idea?

Thanks
Ivan
Gerald M. (Guest)
on 2006-01-04 05:34
(Received via mailing list)
The load path variable is empty when running embedded.
Find your load path by executing something like
ruby -e 'puts $:.join("\n")'

Then check the $:[] before the require statement in the script.

Scripts that load scripts can be loaded into an embedded ruby.
But complicated libraries like tk and fxruby introduce an abundance
of problems: not finding libraries, relocation errors, undefined
methods,
etc., so there use in embedded would be very complicated compared to
running the same script of an unembedded ruby.

Gerald
This topic is locked and can not be replied to.