* Note: since posting this a new version of SWIG has been released (version 1.3.40). This version includes the improved C# wrappers discussed here. A simple explanation about these wrappers can be found here.
After posting my previous post on the improved SWIG C# wrappers for std::vector (std_vector.i) and std::map (std_map.i) I was contacted by one of the main developers of SWIG, William Fulton. This led me to discover the extensive testing suite that SWIG is delivered with.
I tested my improved std_vector.i wrapper against the testing suite, and this went well. Then I wanted to test my std_map.i wrapper, as it is a complete rewrite of the existing wrapper. Since there was no existing test suite for the std_map.i wrapper, I created my own test suite for this wrapper. This flushed out a lot of bugs, and the wrapper is hopefully in much better shape now.
Here is the new version of std_vector.i wrapper: std_vector.i
And the new version of the std_map.i wrapper: std_map.i
The two files relevant for the testing suite of std_map.i are: li_std_map.i and li_std_map_runme.cs
These can be incorporated in the existing SWIG testing suite. I tested them on Windows using Visual Studio. I’m also attaching my C++ and C# solutions for this testing suite. To use them – first rebuild the C++ solution, and then rebuild the C# solution and run it. std_map_test.zip
These wrappers will now hopefully be included in the next release of SWIG, though a good code review wouldn’t hurt…
Please update with your improvement SWIG # Wrapper. Keep it up!
Please update ME with your improvement SWIG # Wrapper. Keep it up!
What version of swig are you using? I tried using the std_map.i but I am running into an error using swig 1.3.38.
I am using a very basic file:
I tested using version 1.3.39, though I think it might be enough to download the updated version of std_vector.i and use:
%template(IntIntMap) std::map<int, int>
Got it working. Thanks.
Could you update your example uisng the 1.3.40, I would like to learn how to use. Especially the distribution does not come with an example that can be compile right out of the box. Thanks
Could you update your example (zip) to 1.3.40. Appreciate
Check out this post for some examples using swig version 1.3.40.
If you have any more questions – feel free to contact me.