embedding ruby - some questions

  • Thread starter Basile STARYNKEVITCH
  • Start date
B

Basile STARYNKEVITCH

Dear All


I am trying to embed Ruby inside an application, a GTK widget server
which recieves ruby instructions to manage a Graphical User Interface
- see http://starynkevitch.net/Basile/guisdoc.html for more; I just
coded a Python based GTK widget server and want to port it to Ruby,
which should be easy, since my code was designed to plug into several
different scripting engines (provided they can load a script file and
interpret a C string).

I have some scoping problems; it seems that definition of functions
parsed by rb_load_file are not visible later when evaluating a C
string using rb_eval_string_protect? so I am running rb_load_file on a
file (guisdemo_rubyscript in my code) which contains

def start(welcomsg)
$stderr.printf("start %s\n", welcomsg)
#etc
end

and then I fo rb_eval_string_protect of a string like the following 2 lines
#request1
start("foobar")

and the start function is unknown

You can download my sample code (which uses ruby-gnome2-all-0.6.0 and
ruby 1.8 [1]) under http://starynkevitch.net/Basile/guis-1.2.post1.tgz
then add . to your $PATH, do a make; make a symbolic link fro ruguis
to ruguis-scripter in your path and run

./guisdemo_rubyscript -T -D -p ./guisdemo_client


Also, I would like ruby to avoid catching SIGINT; Can I do a simple
signal(SIGINT,SIG_DFL) or should I be more careful? (when sent a
SIGINT my app crashs inside Ruby).

At last, I would like to be able to set the "source file name"
(actually to a string like 'request#123') explicitly before calling
rb_eval_string but tb_eval_string does a rb_source_filename already


Note 1: even if ruby-gnome2-all-0.6.0 is not really for ruby-1.8 I
believe this is not my problem, since it appears without calling any
ruby-gnome2 (actually ruby-gtk2) primitives

--

Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top