Embedding ruby-vtk within c++


#1

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
runtime.

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

ruby_init();
ruby_init_loadpath();
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
from

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

Best regards,
gecki