Using Swig 1.3a5, I have noticed the following. If I create a class
class Object {
void bar();
};
in module A.i and I create a function
Object foo();
in another module B.i, Swig will try to redefine that class in the second
module (it makes a call to rb_define_class_under). The problem with this
is that the Object returned from foo() cannot be used as a normal Object.
I can add the line
%extern A.i
to the B.i module, but then the Get_Object macro doesn't get defined,
and I have to code it by hand inside a %{ %} block. What really needs to
be done is that if a data type was referenced in a %extern'd file, then
that data type should be retrieved with rb_const_get (this does require
all the files to be require'd in the correct order, though).
Is there a workaround other than writing my own macros and inserting the
rb_const_get with %init? That's kinda messy and error prone. I've
thought about adding a pragma to the ruby module, but it seems like this
should all occur transparently.
Any suggestions? Thanks,
Paul