Is there any way to pass Ruby objects to a C++ application ? I have never done that kind of thing before and was wondering if that would be possible. Would it require to modify the Ruby core code ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, and no, respectively.
Ruby is written in C. C++ is, by design, C-compatible.
All objects in Ruby are held by a VALUE object (which is a
uniontype), which can be passed around quite easily.Any directions you find for extending Ruby with C apply in C++ with little modification. Alternatively, you can use something like SWIG to simplify writing your extensions.