Can you embedd C++ into Ruby?

Hi,

i have a computationally intensive section of my ruby code that i’d like
to run as C++ code. I’ve heard that it’s easily possible but i don’t
know how to do it. Does anyone have a clue? Any help is appreciated.

Thanks
Chris

Chris wrote:

Hi,

i have a computationally intensive section of my ruby code that i’d like
to run as C++ code. I’ve heard that it’s easily possible but i don’t
know how to do it. Does anyone have a clue? Any help is appreciated.

Thanks
Chris

There have been a lot of threads on how to write extensions in C. Search
the archives and then start with README.EXT in the Ruby source tree. If
your question is specifically about writing an extension in C++, I’ve
always found it best to write the extension boilerplate code in C and
have that code handle the data transitions to and from Rubyland, and
call your C++ code.

Chris wrote:

Posted via http://www.ruby-forum.com/.
Wrong forum. And In general the protocol is to do some searching
(google groups, delicious tags, the pickax and Agile webdev books)
first. I think you want to have a look at writing extconf.rb and C
extensions directly, or using SWIG, Ruby-DL, RubyInline, etc

http://groups.google.com/group/comp.lang.ruby/browse_frm/thread/5b5168f38bee703c?hl=en