From: Yasushi Shoji Date: 2000-05-22T00:10:15-04:00 Subject: [ruby-talk:02920] SWIG: virtual variable? hello, I just tried an example on swig.org http://www.swig.org/tutorial.html with latest swigruby. My question is: Why variable My_variable is defined as a global variable? Shouldn't it defined under the module Example? I don't know what rb_define_virtual_variable() does, so if I'm asking some stupid question, please forgive me kindly ;p regards, -- yashi /* example.i */ %module example %{ /* Put header files here (optional) */ %} extern double My_variable; extern int fact(int n); extern int my_mod(int x, int y); extern char *get_time(); /* File : example.c */ #include double My_variable = 3.0; int fact(int n) { if (n <= 1) return 1; else return n*fact(n-1); } int my_mod(int x, int y) { return (x%y); } char *get_time() { time_t ltime; time(<ime); return ctime(<ime); } #example_test.rb require 'example' print $My_variable, "\n" # Example::My_variable doesn't work. print Example.fact(5), "\n" print Example.get_time, "\n" #extconf.rb require 'mkmf' create_makefile('example')