[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

calling Ruby from C/C++

Mr_Tibs

1/8/2009 6:02:00 PM

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
5 Answers

Mohit Sindhwani

1/8/2009 6:10:00 PM

0

Mr_Tibs wrote:
> 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...

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


Mr_Tibs

1/8/2009 6:21:00 PM

0

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.

Mohit Sindhwani

1/8/2009 6:45:00 PM

0

Mr_Tibs wrote:
> 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....
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...
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.




Mr_Tibs

1/8/2009 7:02:00 PM

0

Coo. Thanks. I don't know how I missed that.

Mohit Sindhwani

1/8/2009 7:20:00 PM

0

Mr_Tibs wrote:
> Coo. Thanks. I don't know how I missed that.
>
It's easy to miss it :)

Hope this helps.

Cheers,
Mohit.
1/9/2009 | 3:19 AM.

>
>