dynload.tcl 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #
  2. # Run this Tcl script to generate the dynload.html file.
  3. #
  4. set rcsid {$Id: dynload.tcl,v 1.1 2001/02/11 16:58:22 drh Exp $}
  5. puts {<html>
  6. <head>
  7. <title>How to build a dynamically loaded Tcl extension for SQLite</title>
  8. </head>
  9. <body bgcolor=white>
  10. <h1 align=center>
  11. How To Build A Dynamically Loaded Tcl Extension
  12. </h1>}
  13. puts {<p>
  14. <i>This note was contributed by
  15. <a href="bsaunder@tampabay.rr.com.nospam">Bill Saunders</a>. Thanks, Bill!</i>
  16. <p>
  17. To compile the SQLite Tcl extension into a dynamically loaded module
  18. I did the following:
  19. </p>
  20. <ol>
  21. <li><p>Do a standard compile
  22. (I had a dir called bld at the same level as sqlite ie
  23. /root/bld
  24. /root/sqlite
  25. I followed the directions and did a standard build in the bld
  26. directory)</p></li>
  27. <li><p>
  28. Now do the following in the bld directory
  29. <blockquote><pre>
  30. gcc -shared -I. -lgdbm ../sqlite/src/tclsqlite.c libsqlite.a -o sqlite.so
  31. </pre></blockquote></p></li>
  32. <li><p>
  33. This should produce the file sqlite.so in the bld directory</p></li>
  34. <li><p>
  35. Create a pkgIndex.tcl file that contains this line
  36. <blockquote><pre>
  37. package ifneeded sqlite 1.0 [list load [file join $dir sqlite.so]]
  38. </pre></blockquote></p></li>
  39. <li><p>
  40. To use this put sqlite.so and pkgIndex.tcl in the same directory</p></li>
  41. <li><p>
  42. From that directory start wish</p></li>
  43. <li><p>
  44. Execute the following tcl command (tells tcl where to fine loadable
  45. modules)
  46. <blockquote><pre>
  47. lappend auto_path [exec pwd]
  48. </pre></blockquote></p></li>
  49. <li><p>
  50. Load the package
  51. <blockquote><pre>
  52. package require sqlite
  53. </pre></blockquote></p></li>
  54. <li><p>
  55. Have fun....</p></li>
  56. </ul>
  57. </body></html>}