From: James Adam Date: 2002-03-28T00:29:20+09:00 Subject: Ruby SWIG problems Hi I've been trying to use Ruby SWIG, but been having limited success. Currently I'm using SWIG 1.3.11, and Ruby 1.7.2 ('stable' ruby versions have given me even less success than below). Here's the scoop: i've got 3 files: /* File : example.h -------------------*/ class TestClass { public: TestClass(); int result; int add(int x, int y); }; /* File : example.cxx ------------------*/ #include "example.h" TestClass::TestClass() { result = 0; } int TestClass::add(int x, int y) { result = x + y; return result; }; /* File : example.i ----------------------*/ %module example %include example.h /*---------------------------------------*/ ....and i run the following commands, all via cygwin (Ruby & SWIG both also compiled using cygwin): $ swig -c++ -ruby example.i $ gcc -c example.cxx $ gcc -c example_wrap.cxx -I/usr/local/lib/ruby/1.6/i386-cygwin $ gcc -shared example.o example_wrap.o -o example.so -lcygwin-ruby17 .... all with no errors. Now when i try and use my new module 'example' - i get this: $ irb TypeError: wrong argument type Fixnum (expected Class) from (irb):1:in `require' from (irb):1 irb(main):002:0> Anyone have any ideas? I've tried using different class definitions, etc etc but with no joy. Thanks James