Alle 20:55, venerd26 gennaio 2007, Shea Martin ha scritto: > > According to one of your previous posts, you use rb_load_file to load a > > file, of course thinking that that was the C function corresponding to > > the ruby 'load' method. The problem is that this is not true. The C > > function corresponding to 'load' is rb_load, which takes one VALUE (the > > name of the file, as a ruby string) and one int (analogous to the second > > parameter of the ruby load method). Of course you could use the function > > corresponding to 'require', rb_require, which takes a char* argument with > > the name of the file. So, you should replace the code > > > > rb_load_file( "test.rb" ) > > > > with > > > > rb_load(rb_str_new2("test.rb"),0); > > > > or with > > > > rb_require("test.rb"); > > > > I hope this solves your problem > > > > Stefano > > I had fixed the problem using rb_require. Would it be better to use > rb_load? rb_load is not mentioned in the pick axe book... which again > brings up the question of if anyone knows of a reference for the ruby > embedded API. > > Thanks, > ~S I think (but I'm not sure) that the difference between the two is exactly the difference between load and require in ruby. Regarding the reference, the only one I know is at www.ruby-doc.org. It doesn't contain documentation, though: it's only a list of functions, variables and the like. It can still be useful, for example to find the name of the C function corresponding to a ruby method or of the object corresponding to one of the classes in ruby. Usually, functions / variables corresponding to ruby methods / classes have names beginning with rb_. Stefano