# Interesting ruby-vtk wrapping issue

**URL:** <https://www.ruby-forum.com/t/interesting-ruby-vtk-wrapping-issue/75151>\
**Category:** Ruby\
**Created:** [March 1, 2006, 11:24am UTC](https://www.ruby-forum.com/t/interesting-ruby-vtk-wrapping-issue/75151 "2006-03-01T11:24:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 1, 2006, 11:24am UTC](https://www.ruby-forum.com/t/interesting-ruby-vtk-wrapping-issue/75151/1 "2006-03-01T11:24:35Z")

</div>

Hello 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
