From: emilie3012@... (Steve Hart) Date: 2003-04-14T10:55:48+09:00 Subject: Re: tutorial on embedding ruby (review) "Simon Strandgaard" <0bz63fz3m1qt3001@sneakemail.com> wrote in message news:... > On Wed, 09 Apr 2003 20:35:03 +0000, Steve Hart wrote: > > > > I'm in the middle of embedding ruby into a c++ project and read the > > tutorial with interest. It's great to see something out there that > > addresses this issue. > > You are lucky that you don't have to figure this out all over again :-) > You are doing very well.. It has taken me too long time to get into > things, just to find out that they were all wrong (some of them). > > > > 1) A more detailed explanation of THE GC interaction would be good. I' > [snip gc issues/questions] > > Many good questions.. > > > > 2) An example explaining finializers would be nice - still not sure if > > I need them. Since I'm probably what Matz would describe as a 'normal' > > user perhaps I should stear clear!. > > Maybe I should make it more clear, that I will not talk about > finalizers. And that you instead should use "close" + blocks. > > > > 3) rb_require over rb_load_protect - I started off using rb_require > > but then found that if rb_require fails with a script error and I then > > corrected the script re re-rb_requiring ignored the changes - I assume > > the script is cached. Switching to rb_load_protect reloads the script > > each time - but is this correct? > > Yes, thats correct. > > > > What does the second argument to rb_load_protect do? > > http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=200104011037.f31AbrS21498%40orsay1.moulon.inra.fr&rnum=12&prev=/groups%3Fq%3Drb_load_protect%26hl%3Den%26lr%3D%26ie%3DUTF-8%26start%3D10%26sa%3DN > http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=200302281436.h1SEaZT27859%40moulon.inra.fr > > The reason why I am using rb_require is that I don't > needs to re-load scripts.. I just load them during > initialization, once and for all. > > This is of cause something which must be explained in the text :-) > > > > 3) More detail for the swig version - especially for the case when a > > ruby class inherits a swigged up c class and you need to pass a > > swigged up c class instance throug to it and then back out again > [snip good example] > > Yes. SWIG puts your classes under a "%module"-namespace. This makes > it a bit ackward... I wonder if its possible to avoid this namespace ? > Well something clearly must be written about this issue. > > > > 4) Also under speed issues - should'nt void mystruct_alloc(VALUE > > klass) return VALUE? > > Oops.. yes. > > > Thanks for your efforts.. this is just what I need. > Simon Strandgaard Thanks Simon, Am looking at latest (1.65) now. I too, saw the aforementioned links relating to rb_load(_protect) The question I meant to ask is realy 'What happens if I call rb_load twice with the same script? I guess I'll find out soon enough since I need to be able to do this. I'm also still a bit unclear about 'anonymous module' - if it's anonymous how do you reference it?. All I know is that if I pass in 1 my call crashes with uninitialized 'constant (NameError)' Anyway, keep up the great work - I for one am finding it invaluable. Cheers