Forum: Ruby embedding ruby-vtk within c++

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2006-03-01 12:28
(Received via mailing list)
interesting ruby-vtk wrapping issueHello everyboy

I'm currently writing my diploma thesis and I'm going to use ruby-vtk
under Linux now.
The aim for this is to extend an existing c++ application using vtk
with some kind of ruby shell.
This allows to modify vtk objects via their wrappers from ruby-vtk at

I would appreciate it very much if you could give me some adice:
I'm trying to write a fragment of code that wraps a c++ vtkPolyData*
object with an SWIG generated ruby object of the class Vtk::PolyData.
I'm start a ruby interpreter and the wrapped object should be
accessible now in ruby via a global variable

vtkPolyData* native = GetPolyData();
VALUE poly; // a ruby Vtk::PolyData object
poly = ???????????????????????? // wrap native
rb_define_variable("$MyPolyData", &poly)

Do you have any ideas how do this?
If  use the function Data_Wrap_Struct(VALUE class, void (*mark)(), void
(*free)(), void *ptr") I don't know where to take the first paramter

Is there any simple answer? A little code fragent or just a hint would
be perfect.
Thx in advance for you answer.

Best regards,
This topic is locked and can not be replied to.