calling Ruby from C/C++

M

Mr_Tibs

Hi,

Is there a way to execute Ruby code from C/C++? I know it is possible
to call Tcl code from C/C++; the Tcl library provides a
Tcl_CreateInterp() function which creates an in-process interpreter
running the Tcl code. Does Ruby provide something similar?

I cannot use any system() or forking functions.

Thanks,
Tiberiu
 
M

Mohit Sindhwani

Mr_Tibs said:
Hi,

Is there a way to execute Ruby code from C/C++? I know it is possible
to call Tcl code from C/C++; the Tcl library provides a
Tcl_CreateInterp() function which creates an in-process interpreter
running the Tcl code. Does Ruby provide something similar?
Yes it does. Search up "ruby c c++" (without quotes) in Google.

Also, see - http://whytheluckystiff.net/ruby/pickaxe/html/ext_ruby.html

Cheers,
Mohit.
1/9/2009 | 2:09 AM.
 
M

Mr_Tibs

It seems that everything I find on the web is about calling C from
Ruby (which is C extensions). I need to do call Ruby from C.
 
M

Mohit Sindhwani

Mr_Tibs said:
It seems that everything I find on the web is about calling C from
Ruby (which is C extensions). I need to do call Ruby from C.

Perhaps, you misunderstood the pages. I asked for you to search "ruby c
c++" - Please see the following:

[1] From the first hit:
http://metaeditor.sourceforge.net/embed/
In this document I will descripe how to embed the ruby interpreter into
c++ [WhyEmbedRuby?, EmbedRuby] and provide you with a skeleton you
easily can build upon.

[2] The URL I sent:
http://whytheluckystiff.net/ruby/pickaxe/html/ext_ruby.html
Please scroll down the page till you find 'Embedding a Ruby Interpreter'

and so on.

You could also search up 'embed ruby c c++'

Cheers,
Mohit.
1/9/2009 | 2:45 AM.
 

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,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top