title: creating ruby C++ extension
body: <p>I created a sample ruby extension using C++ class. it works fine when i did not parse the value. but when i parse parameter it show an error. here is my code.</p>
  
  <p>C++ header file</p>
  
  <pre><code>  #ifndef CIRCLE_H_
    #define CIRCLE_H_
  
  class Circle {
      public:
          Circle(float radius):_radius(radius) {}
          float getArea() { return 3.14159 * _radius * _radius; }
  
      private:
          float _radius;
  
  };
  </code></pre>
  
  <p>CPP file.</p>
  
  <pre><code>  #include&lt;ruby.h&gt;
    #include"Circle.h"
  
    VALUE method_test(VALUE y){
     double x= NUM2DBL(y);
     Circle *cir= new Circle(x);
     return DBL2NUM(cir-&gt;getArea());
    }
  
    extern "C" void Init_Test(){
     VALUE lemon = rb_define_module("Test");
     rb_define_method(lemon, "test", (VALUE(*)(ANYARGS))method_test,1);
    }
  </code></pre>
  
  <p>extconf.rb</p>
  
  <pre><code>    require 'mkmf'
      have_library( 'stdc++' );
      $CFLAGS &lt;&lt; " -Wall"
      create_makefile( 'Test' );
  </code></pre>
  
  <p>run.rb</p>
  
  <pre><code>    require 'rubygems'
  
      require 'Test'
  
      include Test
  
      puts test(7)
  </code></pre>
  
  <p>when i execute run.rb it shows an error.</p>
  
  <pre><code>          run.rb:7:in `test': can't convert Object into Integer (TypeError)
            from run.rb:7:in `&lt;main&gt;'
  </code></pre>
  
  <p>please help me to solve this problem. thank you.</p>