Pass array to a C/C++ Ruby extension

sketchup
array
extension

#1

Hello, I am creating my first c / c ++ ruby extension with the help of the examples found in: https://github.com/SketchUp/ruby-c-extension-examples
I have been able to modify these examples successfully. But now I want to pass an array of ruby to C ++ like the following:

 [  [1, 2, 3],  [2 ,3, 4], [4, 5, 6], ... ]

That correspond to the 3d coordinates of some points, and I want to bring back to ruby another similar array. For the moment I have only been successful with strings and with floats using the example of the repository called SUEX_UsingSWIG, but I do not know how it is done for arrays. Thank you in advance for your help.
(I use google translator, sorry for the mistakes in the translation)


#2

Read this book for that kind of normal Ruby C extension stuff:

This is the Pragmatic Programmer’s Guide to Extending Ruby (for v1.9.2)
by Dave Thomas.
(A companion to the good ol’ “Pick Axe” Pragmatic Programmer’s Guide):


#3

Thank you very much Dan, the book is very interesting.

This could also be useful for someone:
https://sketchucation.com/forums/viewtopic.php?f=180&t=67972


#4

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.