Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C/C++ within Ruby code?

C/C++ would be good option to write some of the performance critical aspects of a Ruby Application. I know this is possible.

I would like to know how to add C/C++ code into Ruby code; any other language for that matter.

Are there any practical applications of this which you noticed in open source projects or else?

like image 617
rpattabi Avatar asked Jul 14 '10 20:07

rpattabi


2 Answers

Besides "Extending Ruby", here are two other resources:

  • README.EXT (extension.rdoc) - shows you more about how to build C extensions. A good compliment to "Extending Ruby"
  • Ruby Inline - This is a library that tries to make it easier to build C extensions by having you call methods in ruby to compile C code.
like image 164
Adrian Avatar answered Sep 20 '22 07:09

Adrian


Look in the "Extending Ruby" section of the Pickaxe book:

http://www.ruby-doc.org/docs/ProgrammingRuby/html/ext_ruby.html

like image 30
peejaybee Avatar answered Sep 21 '22 07:09

peejaybee