From: jjenning@... (jared l. jennings) Date: 2002-05-07T03:42:22+09:00 Subject: Re: Embedding Ruby in C++ On Tue, May 07, 2002 at 02:54:04AM +0900, Rick Bradley wrote: > I used to do a lot of embedding of Perl into C/C++ and C/C++ into Perl, > using SWIG for the latter (actually once I had a C program embed a Perl > interpreter which called SWIG'ed C extensions, but it was not something > I wanted to do a lot of). that was what i was talking about. > At least there (I don't know how it's done w/ Ruby) if you wanted to > embed the Perl interpreter into a C/C++ application you included an .h > file in your C/C++ source, used some macros to initialize the > interpreter, and used some more macros to call Perl routines and pass > values back and forth. You linked with -lperl (IIRC) and ended up with > a big gnarly binary. This is the direction I think the original poster > was wanting to go -- and I'm curious how to do the same thing with Ruby > myself. it's about the same way with ruby. http://www.rubycentral.com/book/ext_ruby.html#S6 > Going the other way (what I'm reading you as saying) one writes some > C/C++ code and then would like to call that functionality from Ruby, > uses SWIG to generate the proper stubs, compiles the stubs+C/C++ and > then does a require from Ruby. essentially, yes. the twist is that the ruby that's required from is embedded. -- Doubt is a pain too lonely to know that faith is his twin brother. - Gibran Khalil Gibran