TCL: Using, adding library files

Source: Internet
Author: User

>The direct reference tool comes with a library file via directives:1. 1 View library file paths that can be called directly # you can find the tool's default library file path, which typically includes the path in the Echo and the parent path to the echo in the path. Info Library #D:/script.net/v2/interps/tcl/lib/tcl8.41.2, in the path of the previous step to find a library without their own needs, through the command: Package require XXX reference, generally directly write Tcl file name, if not, see the PKGINDEX.TCL package ifneeded the name behind. >Refer to someone else's library file or add your own library file below the tool refers to Script.net1, copy the library file that someone else has written to the file path where the compiler is located. Path: D:\Script.NET\V2\interps\Tcl\lib, add in script"Package require XXX", you can call it. 2, create your own library Note: Generally do not use the tool comes with the console to generate Pkg_mkindex, more problems. You can use ACTIVETCL (the following operation, as far as possible using the ACTIVETCL installation of the Tclsh.exe interactive interface to execute commands)2.1, in the tool installation path (such as D:\Script.NET\V2\lib), create your own Lib under the Lib Library path (create a folder), such as: MYLIB1.02.2, put all the TCL files you need to use in this folder (TCL file must include: Package provide fun1.0), provide provides the name and version. 2.3, execute the tool's own console (Tools-to-console), execute Pkg_mkindex-direct"d:\\script.net\\v2\\lib\\mylib1.0"*. Tcl (Tclsh.exe execution can add puts xxx to the script, when the first call, will display the content after puts, using the tool comes with the console will add puts will cause the build to fail, but will not prompt and error) Description: Pkg_mkindex [ -direct--load the file directly under the current path before use, whether or not |-lazy-verbose--dynamic load, load only when used, otherwise, do not load]2. 4 After the build succeeds, there will be a display similar to the following: package ifneeded My_fun1.0[list source [file join $dir fun.tcl]]package ifneeded my_namespace1.0[list source [file Join $dir MY_NAMESPACE.TCL]] Description: Dynamic and static is not the same, but there must be a reference to the file, not all comments content Note: There can be more than one method in a file, but cannot contain puts xxx, otherwise pkg The result of the _mkindex generation will be problematic. Description: The current test, including variables, methods, namespace scripts can be called after the package require XXX. 3, add your own library path tool has a public variable, when executing code, you can use Auto_path directly, using:3.1, displays the path that is automatically referenced by default #show the library of the path which can beusingdirectly. (eg:package require XXX) puts $auto _path3.1, add your own path in a path that is automatically referenced by default, and be aware of the applend and/. #add path to Auto_path. Intro:the path must is splited by"/", Otherwise,it can not work.lappend Auto_path"D:/tcl/lib"puts $auto _path other instructions:1, non-TCL tool instructions, can only be executed in the interactive interface (such as: dir, Ping and other system-brought instructions), if you do not want to be able to execute non-tool in the interaction of instructions, you may define the variable set auto_noexec0(Can be set to any value), at this time dir will be issued error, not recognized. Restore: unset auto_noexec, then enter Dir to see Dir and its corresponding echo.

TCL: Using, adding library files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.