Small, Fast, Reliable.
Choose any three.

About Sitemap Documentation Download License News Developers Support

# How To Build A Dynamically Loaded Tcl Extension

This note was contributed by Bill Saunders. Thanks, Bill!

To compile the SQLite Tcl extension into a dynamically loaded module I did the following:

1. Do a standard compile (I had a dir called bld at the same level as sqlite ie /root/bld /root/sqlite I followed the directions and did a standard build in the bld directory)

2. Now do the following in the bld directory

   >     gcc -shared -I. -lgdbm ../sqlite/src/tclsqlite.c libsqlite.a -o sqlite.so

3. This should produce the file sqlite.so in the bld directory

4. Create a pkgIndex.tcl file that contains this line

   >     package ifneeded sqlite 1.0 [list load [file join $dir sqlite.so]]

5. To use this put sqlite.so and pkgIndex.tcl in the same directory

6. From that directory start wish

7. Execute the following tcl command (tells tcl where to fine loadable modules)

   >     lappend auto_path [exec pwd]

8. Load the package

   >     package require sqlite

9. Have fun....

This page last modified 2007/11/12 14:26:53 UTC