Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > embedding ruby - some questions

Reply
Thread Tools

embedding ruby - some questions

 
 
Basile STARYNKEVITCH
Guest
Posts: n/a
 
      08-31-2003
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
questions about embedding ruby 1.9 Rolando Abarca Ruby 5 04-21-2009 11:46 PM
Questions about SWIG, Ruby/DL and embedding calls to ruby withinC++ Code Charles Comstock Ruby 1 06-25-2004 09:49 PM
Some questions regarding 070-305 and hopefully some right answers. Needs correction... wink, wink ;-) Daniel Walzenbach MCSD 1 11-10-2003 12:25 AM
questions about embedding ruby Basile STARYNKEVITCH Ruby 3 09-02-2003 10:57 AM
Some questions embedding Pythong in C (callback for variable assignment in the dictionary?) jordi Python 0 07-16-2003 02:31 PM



Advertisments