#325 Fix for the win32 issue with MAX_PATH

open
nobody
general (37)
5
2012-12-21
2012-08-17
Anonymous
No

Currently, whenever you have complex C++ types, you can obtain a mangled string of several hundreds of chars.
It translates into SWIGTYPE_xxxx, so it may produce files with very long names.
Windows, even its most recent versions, has very poor support for these files (it just fails silently).
If you want to reproduce the problem, try producing java swig bindings for Ogre3D...
The workaround produced by this patch is that it shortens the mangled string when it is over 100 characters and that the platform is windows.
To be sure not to run into names collision, a hash of the full string is appended to the sortened string.
This patch was produced against svn rev 13637

Discussion


  • Anonymous
    2012-08-25

    Update : fixed the patch, which produced inconsistent results.

     
  • William Fulton
    William Fulton
    2012-08-31

    The hash idea is a good one. This patch needs a couple of improvements though.

    * SWIG's output is identical on all platforms given identical input, currently the patch breaks this.
    * The mangling of the name should be off by default and turned on via a command line option. The option would apply to all languages even though it would be most useful in Java and C#. I suggest the following option which will need to be implemented in a new patch, the output from swig -help would be:

    -shorttypes [n] - Shorten mangled descriptor type names to max size [n], n=100 if omitted.

    * The new option needs to be documented under Doc/Manual showing the effect with a scripting language and a non-scripting language, such as the file write failure that it would overcome for Java. SWIG.html is probably the best place and possibly a mention in the Java chapter too.