From: James17 <jam...@gm...> - 2008-12-22 22:48:12
|
In Ruby all class names must start with a capital letter. SWIG should change this for you automatically but will generate a warning (which you can turn off or avoid by using %rename in your interface). In any case, in your Ruby script try replacing: f = Vikas::vector.new; with f = Vikas::Vector.new; -James vikas951951 wrote: > > > Hello All, > > I am new user of SWIG. I am learning SWIG and had quite an amount of > success > with basics. I am having trouble in accessing C typed structures from > Ruby. > > I have an example.h header file which has > > typedef struct { > double x,y,z; > } vector; > > my example.i (swig interface) looks like this > > %module vikas > > %{ > #include "example.h" > %} > > I want to access this structure from Ruby. So I created run_ruby.rb as > > require 'vikas' > > f = Vikas::vector.new; > > f.x = 5; > > puts "x is #{f.x}"; > > > But I am constantly getting an error as > > "NoMethodError: undefined method `vector' for Vikas:Module" > > > can anyone please help me? > > Best Regards > Vikas > > > > > > -- > View this message in context: > http://www.nabble.com/problem-in-using-typedef-structures-of-C-from-ruby-using-SWIG-tp20997117p20997117.html > Sent from the swig-user mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, > Nevada. > The future of the web can't happen without you. Join us at MIX09 to help > pave the way to the Next Web now. Learn more and register at > http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ > _______________________________________________ > Swig-user mailing list > Swi...@li... > https://lists.sourceforge.net/lists/listinfo/swig-user > > -- View this message in context: http://www.nabble.com/problem-in-using-typedef-structures-of-C-from-ruby-using-SWIG-tp21049346p21135697.html Sent from the swig-user mailing list archive at Nabble.com. |