1 Sep 2007 02:36
[ swig-Bugs-1785770 ] vector of enums isn't passed correctly
SourceForge.net <noreply <at> sourceforge.net>
2007-09-01 00:36:45 GMT
2007-09-01 00:36:45 GMT
Bugs item #1785770, was opened at 2007-08-31 15:42 Message generated for change (Comment added) made by gga73 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1785770&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: ruby Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: dsomerfield (dsomerfield) Assigned to: Gonzalo Garramuno (gga73) Summary: vector of enums isn't passed correctly Initial Comment: I have defined an enum Test::NUMBER and a method with a parameter of type vector<Test::NUMBER>. I have added an include in the swig file for "std_vector.i" and added a %template directive that should handle the vector. Instead, I get a segfault coming from _wrap_Test_test_enum_vector in the wrapper file. It seems to fail when calling push_back() on the instance of std::vector<Test::NUMBER > (line 3045). The method is called fine if the parameter is std::vector<int> or just Test::Number. Incidentally, the included code is a stripped-down a larger project wherein I originally saw the bug. However, since I was calling the method in a different context, the segfault was not occuring, rather the ENUM values were changed. I have not been able to do a simple repro of this. If you would like to see the code from the bigger project, I can provide that too, since it is an open-source project. Version info: ruby 1.8.5 Windows XP SP 2. Swig 1.3.31 Microsoft Visual C++ 2005. Note that if you want to use the VC++ project, paths must be changed in the "Debugging" and "Build Swig" properties and ---------------------------------------------------------------------- >Comment By: Gonzalo Garramuno (gga73) Date: 2007-08-31 21:36 Message: 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 >; ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1785770&group_id=1645 ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
RSS Feed