From: Simon Strandgaard <0bz63fz3m1qt3001@...> Date: 2003-04-10T20:23:59+09:00 Subject: Re: tutorial on embedding ruby (review) 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