From: intc_ctor@... (Phil Tomson) Date: 2004-01-09T06:46:40+09:00 Subject: Re: convert a C/C++ array to a Ruby array elathan@phys.uoa.gr wrote in message news:<1073567518.3ffd571e18e36@webmail.uoa.gr>... > Quoting nobu.nokada@softhome.net: > > > Actually it is part of the functionallity a C++ Class embeds: > > > > > > Foo::Foo(int n, double *f); > > > double * Foo::Get(); > > > > > > Okay, I can grab 'n' from the constructor and use it as the length > > > of the Ruby/C array, but I wanted to make sure that there is no > > > general way to procceed without messing with the details of the > > > C/C++ code. > > > > If you can get the length from Foo, you can use it. > > Yes I know. The problem is that I am creating Ruby bindings for a large > framework (more than 50 C++ classes) and the bindings code is automagically > generated by reading the C++ prototypes, using a handmade Ruby > parser/compiler. > > The generated code is quite readable and can be altered by a human, but > I want to eliminate as much as I can the human intervation, so as the majority of the > C++ prototypes to be compiled in the Ruby API without human editing. > > > I checked SWIG and it returns a special SWIG object in that case... > I'm just curious, why didn't you use SWIG for this? Sounds sort of like you're recreating SWIG. Phil