/ Artifact Content

Artifact 02eb8273aa78cfa9070dd4501dca937fb22b466c:

# 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 {<html>
  <title>How to build a dynamically loaded Tcl extension for SQLite</title>
<body bgcolor=white>
<h1 align=center>
How To Build A Dynamically Loaded Tcl Extension
puts {<p>
<i>This note was contributed by 
<a href="bsaunder@tampabay.rr.com.nospam">Bill Saunders</a>.  Thanks, Bill!</i>

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

<li><p>Do a standard compile
(I had a dir called bld at the same level as sqlite  ie
I followed the directions and did a standard build in the bld

Now do the following in the bld directory
gcc -shared -I. -lgdbm ../sqlite/src/tclsqlite.c libsqlite.a -o sqlite.so

This should produce the file sqlite.so in the bld directory</p></li>

Create a pkgIndex.tcl file that contains this line

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

To use this put sqlite.so and pkgIndex.tcl in the same directory</p></li>

From that directory start wish</p></li>

Execute the following tcl command (tells tcl where to fine loadable
lappend auto_path [exec pwd]

Load the package 
package require sqlite

Have fun....</p></li>