#267 Tcl: fix for multi-import global variable problem


SWIG uses a global variable in the Tcl interpreter to track the first module that was loaded. Currently, the code that sets the variable does not explicitly use the global namespace. This works correctly as long as you load the modules outside of a namespace and outside of a procedure. If you load the modules within a namespace or procedure, or if you using Tcl packaging system, the 2nd module will overwrite the global variable and there will be no linkage between them.

The attached patch contains a tiny fix for the problem as well as a modification to the tcl imports test to reproduce the issue.


  • Christian Delbaere

    Patch file for Tcl global variable import problem

  • Christian Delbaere

    This patch is applied to the version 2.0.3 release.

  • William Fulton

    William Fulton - 2011-05-17

    The test doesn't fail for me with or without the changes to imports_runme.tcl, nevertheless, I've committed it for swig-2.0.4.

  • William Fulton

    William Fulton - 2011-05-17
    • assigned_to: nobody --> wsfulton
    • status: open --> closed-accepted

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks