Forum: Ruby embedding ruby-vtk within c++

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F290789fe2768119c96e75bcabb7115f?d=identicon&s=25 unknown (Guest)
on 2006-03-01 11: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
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
This topic is locked and can not be replied to.