Pass array to a C/C++ Ruby extension

Hello, I am creating my first c / c ++ ruby extension with the help of the examples found in: GitHub - SketchUp/ruby-c-extension-examples: 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)

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):

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

1 Like

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