# # Run this Tcl script to generate the dynload.html file. # set rcsid {$Id: dynload.tcl,v 1.1 2001/02/11 16:58:22 drh Exp $} puts { How to build a dynamically loaded Tcl extension for SQLite

How To Build A Dynamically Loaded Tcl Extension

} puts {

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....

  10. }