Swig is a lifesaver for using native C++ libraries in a higher level language. One problem I came across this morning, though, if you are referencing two swig-generated libraries in one application, you can get name collisions for similar types. My problem arose out of my use of the %pointer_functions macro. The generated types, SWIGTYPE_p_int, SWIGTYPE_p_long, SWIGTYPE_p_double and SWIGTYPE_p_float were all generated in the root namespace. So, when my .NET application referenced two libraries generated this way, no joy! Unfortunately, it took me a while to work out how to put the swig-generated types into an appropriate namespace, so I thought I’d document it here for you to find. The answer was to be found here, on the SWIG and C# page of the documentation. Simply add -namespace whatever.namespace.you.want to the commandline arguments. too easy!
swig.exe -c++ -csharp -namespace MyCSNamespace -outdir "swig" "script.i"