Version : SWIG 1.3.36
1) Create a SWIG Ruby interface that uses std::vector for some type, e.g. Foo.
2) Specialize template via: %template (FooVector) std::vector<Foo>;
2) Build and attempt to load the extension
Load fails with an exception since the generated line in the method section for FooVector's wrapper code:
rb_define_alias(cFooVector.klass, "delete_if", "reject!")
This is because rb_define_alias is called _before_ rb_include_module(cFooVector.klass, cFooVector.mImpl) when multiple inheritance support is employed.
This is a bug introduced during the Ruby STL upgrades between 1.3.31 and 1.3.36. The attached patch fixes the problem by moving the rb_include_module() call to the head of the wrapped function's init section. Note that it is perfectly acceptable to do the include operation in Ruby before methods are defined on the included module.