From: Alexander Schofield Date: 2002-02-14T15:58:39+09:00 Subject: Re: restarting interpreter, undefining objects..? Could you fake this multiple processes? That is, fork off a child process when a plug-in is loaded? The performance hit shouldn't be too bad, they'd share text segments and a lot of the modern Unices have some pretty impressive copy-on-write semantics. The parent would then roughly correspond to the main driver and the plug-in unloading would correspond to a child proc exiting. You'd have to ensure that only child procs started Ruby, and child procs were only forked off from the parent. At least that would be the ideal, a snag of course would be if the child had to share info about the next plug-in to be loaded with the parent. Then you'd need a more complicated IPC mechanism, unless you got creative with wait. If you're on NT I'm useless to you, but from a recent Rubygarden poll statistics are on my side. Fitzberg Brian wrote: > > Hi there, > > I'm working on an application (C/C++) that will use ruby > as a plug-in scripting language. So far I've had pretty > good success loading and invoking ruby code from the > application, however I've hit a bit of a snag. > > Basically, when the app. switches to another plug-in, I > would like to "undefine" the previously loaded one. That > is, I want to be able to load ruby code and execute it > (I'm doing this by calling pre-named methods in a > pre-named object), then "unload" this ruby code so that I > can load another and execute that without there being any > conflict (or waste of resources). > > Is it possible to clear or reset the embedded interpreter? > Alternatively, is it possible to shut down and re-start > the interpreter? I have not managed to find anything to > do the first, and so far have not been able to shut down > the interpreter without it causing the calling app to > exit. (I did, however, discover the set exit function, > but that still does not prevent the exit from occuring.) > > Any help would be greatly appreciated. Thanks for your > time! > > __________________________________________________ > Do You Yahoo!? > Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- Alexander Schofield