OpenDB icon indicating copy to clipboard operation
OpenDB copied to clipboard

OpenDB as a TCL package, rather than a standalone executable

Open Colin-Holehouse opened this issue 5 years ago • 1 comments

The integration of OpenDB with Python provides it as a package that gets loaded into the Python interpreter.

The same can be done with TCL. Rather than having a separate executable, if opendbtcl is built as a shared object library, then it can be loaded into any TCL shell through the package loading mechanism.

Alongside the shared object library there would be a TCL file called pkgIndex.tcl, which would load the shared object library if required. This would look something like:

package ifneeded opendbtcl 1.0.0 [list load $dir/libopendbtcl.so]

The end user would add the path of the directory where the pkgIndex.tcl file could be found to the environment variable TCLLIBPATH so that all the packages are known (but not loaded) when the tclsh starts up.

More information on the TCL load command: http://tmml.sourceforge.net/doc/tcl/load.html

To use the opendbtcl package, the end user would do the following:

% tclsh > package require opendbtcl

Taking this approach will make the python/tcl approach more consistent and tidy up some loose ends in the current opendbtcl binary [e.g. the package mechanism not working]

Colin-Holehouse avatar Nov 13 '19 14:11 Colin-Holehouse

The current build generates a library file too, it just was not set to SHARED by mistake (will fix that), we can also provide pkgIndex.tcl so the package require would work normally but we probably won't drop the standalone executable as it is the approach with most OpenROAD apps, and will be required for the top-level app to work, and we need it too to inject the TCL wrappers as SWIG currently does not support inline TCL code.

ahmed-agiza avatar Nov 13 '19 18:11 ahmed-agiza