Open SwigAtSF opened 11 years ago
zipped visual c++ project
Logged In: YES user_id=961712 Originator: NO
This file seems to not have been created with the latest release of swig on SVN, but the much older swig1.31.
Can you download the latest SVN, compile it and try it? Compilation on windows means you will need to install MSYS and autotools for it (this is kind of a pain, I'll admit -- until there's a proper formal release).
I'm attaching a simple example that works for that version.
%module enumvector
%include std_vector.i
%inline { namespace test {
enum Number { One, Two, Three };
}
}
// this should work, but it is broken as test::Number is interpreted as // a class and there's no type_info() for it (I'll see if this can be fixed easily): // // %template(EnumVector) std::vector< test::Number >;
%template(EnumVector) std::vector< int >;
Logged In: YES user_id=1174478 Originator: YES
I am trying, but not having much luck with the build under windows. If I get it to work, I will give it a try.
Logged In: YES user_id=1174478 Originator: YES
Actually, both the 1.31 and the latest from trunk seem to work fine if you don't declare methods with parameters of type vectortest:Number but rather as vector
. That is an acceptable work-around for now, although it would obviously be ideal if enumeration were recognized as such.
Logged In: YES user_id=153408 Originator: NO
Try the latest svn... I recently fixed a bug very similar to this... I suspect it is fixed now.
Logged In: YES user_id=961712 Originator: NO
Sadly, the bug persists. The problem is how the type_info() is handled as the enum is not interpreted as an int, but as a class. The problem shows up on ruby only because by default the std_vector.i classes know how to print themselves out unlike python or other languages.
I have attached an even simpler .i file with a Makefile for linux showing the bug. I don't think the problem lies with the ruby module, but how swig's parser handles enums. File Added: gga_example.zip