C/C++ within Ruby code?

后端 未结 6 2274
暗喜
暗喜 2021-02-10 09:39

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 i

相关标签:
6条回答
  • 2021-02-10 10:09

    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.
    0 讨论(0)
  • 2021-02-10 10:10

    Seems like you need to read up on Extending Ruby

    0 讨论(0)
  • 2021-02-10 10:21

    you should have a look at SWIG - it allows you to create ruby extensions in C/C++.

    0 讨论(0)
  • 2021-02-10 10:23

    We use ffi in one of our projects.

    Ruby-FFI is a ruby extension for programmatically loading dynamic libraries, binding functions within them, and calling those functions from Ruby code. Moreover, a Ruby-FFI extension works without changes on Ruby and JRuby.

    It works quite well.

    0 讨论(0)
  • 2021-02-10 10:23

    Compile your high performance code into a system service/executable, and call it from inside Ruby...?

    0 讨论(0)
  • 2021-02-10 10:24

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

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

    0 讨论(0)
提交回复
热议问题