From: Joel VanderWerf Date: 2004-07-15T14:15:07+09:00 Subject: Re: No Subject Jesse van den Kieboom wrote: >> The loaded file need to call the register_functions, i.e. rather than >> define a register_function the file must call any method that it want > > > Now I'm really confused. I can't call any functions that sit in the > loaded file. I can't define functions from within C that the ruby script > I load can call. What CAN I do then. I need to let my C application know > what methods there are. Every method registered is a little script. And > I need to execute these methods from my C application. > > >> You can't specify a module : the module don't exist after the load this is >> why ruby lost the definitions. > > > So how to call a function from the loaded file... I'm not sure I've followed the discussion, but this is something I use to load (or require) a script and get an actual object (a module, in fact) that has the methods (and constants) defined in the script: http://redshift.sourceforge.net/script/ The basic idea is just "module_eval(IO.read(file))", but there's some convenience stuff around that.