Artifact
caabe653648087d485c9f9c2b0623abffd9dc3f4:
Wiki page
[mod_spatialite] by
sandro
2014-06-25 21:34:20.
0000: 44 20 32 30 31 34 2d 30 36 2d 32 35 54 32 31 3a D 2014-06-25T21:
0010: 33 34 3a 32 30 2e 34 32 35 0a 4c 20 6d 6f 64 5f 34:20.425.L mod_
0020: 73 70 61 74 69 61 6c 69 74 65 0a 50 20 38 31 39 spatialite.P 819
0030: 66 61 38 35 64 63 33 61 61 63 32 34 39 65 64 39 fa85dc3aac249ed9
0040: 33 65 32 65 66 66 62 32 61 31 35 35 30 62 65 30 3e2effb2a1550be0
0050: 64 32 38 33 39 0a 55 20 73 61 6e 64 72 6f 0a 57 d2839.U sandro.W
0060: 20 38 32 30 36 0a 62 61 63 6b 20 74 6f 20 3c 61 8206.back to <a
0070: 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77 href="https://w
0080: 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 66 ww.gaia-gis.it/f
0090: 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69 61 6c ossil/libspatial
00a0: 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 34 2e ite/wiki?name=4.
00b0: 32 2e 30 2d 64 6f 63 22 3e 34 2e 32 2e 30 2d 64 2.0-doc">4.2.0-d
00c0: 6f 63 3c 2f 61 3e 0d 0a 3c 68 31 3e 44 79 6e 61 oc</a>..<h1>Dyna
00d0: 6d 69 63 61 6c 6c 79 20 6c 6f 61 64 69 6e 67 20 mically loading
00e0: 53 70 61 74 69 61 4c 69 74 65 20 61 73 20 61 6e SpatiaLite as an
00f0: 20 3c 75 3e 3c 69 3e 65 78 74 65 6e 73 69 6f 6e <u><i>extension
0100: 20 6d 6f 64 75 6c 65 3c 2f 69 3e 3c 2f 75 3e 3c module</i></u><
0110: 2f 68 31 3e 0d 0a 3c 68 33 3e 54 68 65 6f 72 65 /h1>..<h3>Theore
0120: 74 69 63 61 6c 20 66 6f 75 6e 64 61 74 69 6f 6e tical foundation
0130: 73 3c 2f 68 33 3e 0d 0a 53 70 65 61 63 6b 69 6e s</h3>..Speackin
0140: 67 20 69 6e 20 72 69 67 6f 72 6f 75 73 20 74 65 g in rigorous te
0150: 63 68 6e 69 63 61 6c 20 74 65 72 6d 73 2c 20 53 chnical terms, S
0160: 70 61 74 69 61 4c 69 74 65 20 73 69 6d 70 6c 79 patiaLite simply
0170: 20 69 73 20 61 6e 20 65 78 74 65 6e 73 69 6f 6e is an extension
0180: 20 74 6f 20 53 51 4c 69 74 65 2e 3c 62 72 3e 0d to SQLite.<br>.
0190: 0a 43 6f 6e 73 65 71 75 65 6e 74 6c 79 20 77 65 .Consequently we
01a0: 20 61 72 65 20 73 74 72 69 63 74 6c 79 20 72 65 are strictly re
01b0: 71 75 69 72 65 64 20 74 6f 20 64 65 70 6c 6f 79 quired to deploy
01c0: 20 73 6f 6d 65 20 61 70 70 72 6f 70 72 69 61 74 some appropriat
01d0: 65 20 6d 65 63 68 61 6e 69 73 6d 20 61 6c 6c 6f e mechanism allo
01e0: 77 69 6e 67 20 74 6f 20 6c 6f 61 64 20 62 6f 74 wing to load bot
01f0: 68 20 62 69 6e 61 72 79 20 6c 69 62 72 61 72 69 h binary librari
0200: 65 73 20 28 3c 69 3e 6c 69 62 73 71 6c 69 74 65 es (<i>libsqlite
0210: 33 3c 2f 69 3e 20 61 6e 64 20 3c 69 3e 6c 69 62 3</i> and <i>lib
0220: 73 70 61 74 69 61 6c 69 74 65 3c 2f 69 3e 29 20 spatialite</i>)
0230: 74 68 65 6e 20 70 72 6f 70 65 72 6c 79 20 72 65 then properly re
0240: 67 69 73 74 65 72 69 6e 67 20 77 69 74 68 69 6e gistering within
0250: 20 53 51 4c 69 74 65 33 20 74 68 65 20 6d 61 6e SQLite3 the man
0260: 79 20 3c 62 3e 3c 69 3e 65 78 74 65 6e 64 65 64 y <b><i>extended
0270: 20 53 70 61 74 69 61 6c 20 53 51 4c 20 66 75 6e Spatial SQL fun
0280: 63 74 69 6f 6e 73 3c 2f 69 3e 3c 2f 62 3e 20 69 ctions</i></b> i
0290: 6d 70 6c 65 6d 65 6e 74 65 64 20 62 79 20 53 70 mplemented by Sp
02a0: 61 74 69 61 4c 69 74 65 2e 3c 62 72 3e 0d 0a 41 atiaLite.<br>..A
02b0: 20 66 75 72 74 68 65 72 20 63 6f 6d 70 69 63 61 further compica
02c0: 74 69 6f 6e 20 73 68 6f 75 6c 64 20 62 65 20 74 tion should be t
02d0: 61 6b 65 6e 20 69 6e 20 70 72 6f 70 65 72 20 64 aken in proper d
02e0: 65 62 74 3b 20 3c 69 3e 6c 69 62 73 70 61 74 69 ebt; <i>libspati
02f0: 61 6c 69 74 65 3c 2f 69 3e 20 69 73 6e 27 74 20 alite</i> isn't
0300: 61 20 73 69 6d 70 6c 65 20 73 74 61 6e 64 2d 61 a simple stand-a
0310: 6c 6f 6e 65 20 73 65 6c 66 2d 63 6f 6e 74 61 69 lone self-contai
0320: 6e 65 64 20 6c 69 62 72 61 72 79 20 61 6e 64 20 ned library and
0330: 64 65 70 65 6e 64 73 20 6f 6e 20 73 65 76 65 72 depends on sever
0340: 61 6c 20 66 75 72 74 68 65 72 20 6c 69 62 72 61 al further libra
0350: 72 69 65 73 20 28 3c 69 3e 6c 69 62 67 65 6f 73 ries (<i>libgeos
0360: 3c 2f 69 3e 2c 20 3c 69 3e 6c 69 62 70 72 6f 6a </i>, <i>libproj
0370: 3c 2f 69 3e 2c 20 3c 69 3e 6c 69 62 78 6d 6c 32 </i>, <i>libxml2
0380: 3c 2f 69 3e 20 61 6e 64 20 73 6f 20 6f 6e 29 2e </i> and so on).
0390: 3c 62 72 3e 3c 62 72 3e 0d 0a 54 68 65 72 65 20 <br><br>..There
03a0: 61 72 65 20 73 65 76 65 72 61 6c 20 70 6f 73 73 are several poss
03b0: 69 62 6c 65 20 61 6c 74 65 72 6e 61 74 69 76 65 ible alternative
03c0: 20 70 61 74 68 73 20 6c 65 61 64 69 6e 67 20 74 paths leading t
03d0: 6f 20 74 68 69 73 20 66 69 6e 61 6c 20 67 6f 61 o this final goa
03e0: 6c 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 75 73 l:..<ul>..<li>us
03f0: 69 6e 67 20 3c 62 3e 3c 69 3e 73 74 61 74 69 63 ing <b><i>static
0400: 20 6c 69 6e 6b 61 67 65 3c 2f 69 3e 3c 2f 62 3e linkage</i></b>
0410: 3a 20 61 20 73 74 72 61 69 67 68 66 6f 72 77 61 : a straighforwa
0420: 72 64 20 73 6f 6c 75 74 69 6f 6e 20 61 76 6f 69 rd solution avoi
0430: 64 69 6e 67 20 6d 61 6e 79 20 73 75 62 73 65 71 ding many subseq
0440: 75 65 6e 74 20 68 65 61 64 68 61 63 68 65 73 20 uent headhaches
0450: 72 65 6c 61 74 65 64 20 74 6f 20 69 6e 73 74 61 related to insta
0460: 6c 6c 61 74 69 6f 6e 20 61 6e 64 20 72 75 6e 2d llation and run-
0470: 74 69 6d 65 20 63 6f 6e 66 69 67 75 72 61 74 69 time configurati
0480: 6f 6e 2e 3c 62 72 3e 0d 0a 46 6f 6c 6c 6f 77 69 on.<br>..Followi
0490: 6e 67 20 74 68 69 73 20 61 70 70 72 6f 61 63 68 ng this approach
04a0: 20 61 20 73 69 6e 67 6c 65 20 6d 6f 6e 6f 6c 69 a single monoli
04b0: 74 68 69 63 20 3c 62 3e 3c 69 3e 66 61 74 3c 2f thic <b><i>fat</
04c0: 69 3e 3c 2f 62 3e 20 65 78 65 63 75 74 61 62 6c i></b> executabl
04d0: 65 20 69 6e 74 65 72 6e 61 6c 6c 79 20 63 6f 6e e internally con
04e0: 74 61 69 6e 69 6e 67 20 61 6c 6c 20 72 65 71 75 taining all requ
04f0: 69 72 65 64 20 62 69 6e 61 72 79 20 63 6f 64 65 ired binary code
0500: 20 77 69 6c 6c 20 62 65 20 63 72 65 61 74 65 64 will be created
0510: 20 61 74 20 62 75 69 6c 64 20 74 69 6d 65 3b 20 at build time;
0520: 74 68 69 73 20 6d 6f 6e 6f 6c 69 74 68 69 63 20 this monolithic
0530: 65 78 65 63 75 74 61 62 6c 65 20 77 69 6c 6c 20 executable will
0540: 68 61 76 65 20 6e 6f 20 65 78 74 65 72 6e 61 6c have no external
0550: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 61 74 dependencies at
0560: 20 61 6c 6c 2c 20 74 68 75 73 20 72 61 64 69 63 all, thus radic
0570: 61 6c 6c 79 20 73 69 6d 70 6c 69 66 79 69 6e 67 ally simplifying
0580: 20 61 6e 79 20 69 6e 73 74 61 6c 6c 61 74 69 6f any installatio
0590: 6e 20 74 61 73 6b 2e 3c 62 72 3e 0d 0a 53 75 63 n task.<br>..Suc
05a0: 68 20 73 74 72 61 74 65 67 79 20 6e 69 63 65 6c h strategy nicel
05b0: 79 20 77 6f 72 6b 73 20 69 6e 20 74 68 65 20 63 y works in the c
05c0: 61 73 65 20 6f 66 20 73 74 61 6e 64 2d 61 6c 6f ase of stand-alo
05d0: 6e 65 20 73 65 6c 66 2d 63 6f 6e 74 61 69 6e 65 ne self-containe
05e0: 64 20 61 70 70 73 20 28 65 2e 67 2e 20 62 6f 74 d apps (e.g. bot
05f0: 68 20 3c 62 3e 73 70 61 74 69 61 6c 69 74 65 2e h <b>spatialite.
0600: 65 78 65 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 73 exe</b> and <b>s
0610: 70 61 74 69 61 6c 69 74 65 5f 67 75 69 2e 65 78 patialite_gui.ex
0620: 65 3c 2f 62 3e 20 57 69 6e 64 6f 77 73 20 62 69 e</b> Windows bi
0630: 6e 61 72 69 65 73 20 61 72 65 20 75 73 75 61 6c naries are usual
0640: 6c 79 20 62 75 69 6c 74 20 74 68 69 73 20 77 61 ly built this wa
0650: 79 29 2e 3c 62 72 3e 0d 0a 55 6e 68 61 70 70 69 y).<br>..Unhappi
0660: 6c 79 20 74 68 69 73 20 65 6c 65 6d 65 6e 74 61 ly this elementa
0670: 72 79 20 73 69 6d 70 6c 65 20 73 6f 6c 75 74 69 ry simple soluti
0680: 6f 6e 20 64 6f 65 73 6e 27 74 20 66 69 74 20 77 on doesn't fit w
0690: 65 6c 6c 20 69 6e 20 4c 69 6e 75 78 20 61 6e 64 ell in Linux and
06a0: 20 55 6e 69 78 2d 6c 69 6b 65 20 65 6e 76 69 72 Unix-like envir
06b0: 6f 6e 6d 65 6e 74 73 3b 20 61 6e 64 20 65 76 65 onments; and eve
06c0: 6e 20 77 6f 72 73 74 20 6f 66 74 65 6e 20 64 69 n worst often di
06d0: 72 65 63 74 6c 79 20 63 6f 6e 66 6c 69 63 74 73 rectly conflicts
06e0: 20 77 69 74 68 20 74 68 65 20 69 6e 74 65 72 6e with the intern
06f0: 61 6c 20 61 72 63 68 69 74 65 63 74 75 72 65 20 al architecture
0700: 73 75 70 70 6f 72 74 65 64 20 62 79 20 6d 61 6e supported by man
0710: 79 20 6c 61 6e 67 75 61 67 65 20 63 6f 6e 6e 65 y language conne
0720: 63 74 6f 72 73 20 6f 72 20 62 79 20 6f 74 68 65 ctors or by othe
0730: 72 20 63 6f 6d 70 6c 65 78 20 66 72 61 6d 65 77 r complex framew
0740: 6f 72 6b 73 20 28 61 73 20 65 2e 67 2e 20 69 73 orks (as e.g. is
0750: 20 3c 62 3e 51 47 49 53 3c 2f 62 3e 29 2e 3c 2f <b>QGIS</b>).</
0760: 6c 69 3e 0d 0a 3c 6c 69 3e 75 73 69 6e 67 20 3c li>..<li>using <
0770: 62 3e 3c 69 3e 73 68 61 72 65 64 20 6c 69 62 72 b><i>shared libr
0780: 61 72 69 65 73 3c 69 3e 3c 2f 62 3e 20 28 61 6b aries<i></b> (ak
0790: 61 20 3c 62 3e 3c 69 3e 44 4c 4c 73 3c 2f 69 3e a <b><i>DLLs</i>
07a0: 3c 2f 62 3e 20 6f 6e 20 57 69 6e 64 6f 77 73 29 </b> on Windows)
07b0: 2e 3c 62 72 3e 0d 0a 54 68 69 73 20 73 65 63 6f .<br>..This seco
07c0: 6e 64 20 61 70 70 72 6f 61 63 68 20 77 69 6c 6c nd approach will
07d0: 20 63 61 72 65 66 75 6c 6c 79 20 61 76 6f 69 64 carefully avoid
07e0: 20 74 6f 20 6c 69 6e 6b 20 6f 6e 63 65 20 66 6f to link once fo
07f0: 72 20 61 6c 6c 20 61 20 6d 6f 6e 6f 6c 69 74 68 r all a monolith
0800: 69 63 20 65 78 65 63 75 74 61 62 6c 65 3b 20 61 ic executable; a
0810: 74 20 74 68 65 20 6f 70 70 6f 73 69 74 65 2c 20 t the opposite,
0820: 65 61 63 68 20 73 69 6e 67 6c 65 20 63 6f 64 65 each single code
0830: 20 63 6f 6d 70 6f 6e 65 6e 74 20 77 69 6c 6c 20 component will
0840: 62 65 20 73 68 69 70 70 65 64 20 61 73 20 61 6e be shipped as an
0850: 20 61 75 74 6f 6e 6f 6d 6f 75 73 20 69 6e 64 69 autonomous indi
0860: 76 69 64 75 61 6c 20 6d 65 6d 62 65 72 2c 20 61 vidual member, a
0870: 6e 64 20 6f 6e 6c 79 20 61 74 20 72 75 6e 2d 74 nd only at run-t
0880: 69 6d 65 20 61 6c 6c 20 63 6f 6d 70 6f 6e 65 6e ime all componen
0890: 74 73 20 77 69 6c 6c 20 62 65 20 66 69 6e 61 6c ts will be final
08a0: 6c 79 20 62 6f 75 6e 64 20 74 6f 67 65 74 68 65 ly bound togethe
08b0: 72 2e 3c 62 72 3e 0d 0a 54 68 65 20 67 6f 6f 64 r.<br>..The good
08c0: 20 6e 65 77 20 69 73 20 74 68 61 74 20 74 68 69 new is that thi
08d0: 73 20 77 61 79 20 65 61 63 68 20 6c 69 62 72 61 s way each libra
08e0: 72 79 2f 63 6f 6d 70 6f 6e 65 6e 74 20 77 69 6c ry/component wil
08f0: 6c 20 62 65 20 28 68 6f 70 65 66 75 6c 6c 79 29 l be (hopefully)
0900: 20 69 6e 73 74 61 6c 6c 65 64 20 6f 6e 6c 79 20 installed only
0910: 6f 6e 63 65 20 6f 6e 20 79 6f 75 72 20 73 79 73 once on your sys
0920: 74 65 6d 2c 20 61 6e 64 20 74 68 61 74 20 65 76 tem, and that ev
0930: 65 72 79 20 65 78 65 63 75 74 61 62 6c 65 20 64 ery executable d
0940: 65 70 65 6e 64 69 6e 67 20 6f 6e 20 74 68 61 74 epending on that
0950: 20 6c 69 62 72 61 72 79 20 77 69 6c 6c 20 6c 6f library will lo
0960: 61 64 20 65 78 61 63 74 6c 79 20 74 68 65 20 73 ad exactly the s
0970: 61 6d 65 20 62 69 6e 61 72 79 20 63 6f 64 65 2c ame binary code,
0980: 20 74 68 75 73 20 67 72 61 6e 74 69 6e 67 20 61 thus granting a
0990: 20 72 6f 62 75 73 74 20 6f 76 65 72 61 6c 6c 20 robust overall
09a0: 63 6f 6e 73 69 73 74 65 6e 63 79 2e 3c 62 72 3e consistency.<br>
09b0: 0d 0a 54 68 65 20 62 61 64 20 6e 65 77 20 69 73 ..The bad new is
09c0: 20 69 6e 20 74 68 61 74 20 69 66 20 61 20 73 69 in that if a si
09d0: 6e 67 6c 65 20 72 65 71 75 69 72 65 64 20 63 6f ngle required co
09e0: 6d 70 6f 6e 65 6e 74 20 63 6f 75 6c 64 6e 27 74 mponent couldn't
09f0: 20 62 65 20 6c 6f 61 64 65 64 20 61 74 20 72 75 be loaded at ru
0a00: 6e 2d 74 69 6d 65 20 28 66 6f 72 20 61 6e 79 20 n-time (for any
0a10: 70 6f 73 73 69 62 6c 65 20 72 65 61 73 6f 6e 29 possible reason)
0a20: 20 74 68 65 20 65 78 65 63 75 74 61 62 6c 65 20 the executable
0a30: 61 73 20 61 20 77 68 6f 6c 65 20 77 69 6c 6c 20 as a whole will
0a40: 66 61 69 6c 20 74 6f 20 72 75 6e 2e 3c 62 72 3e fail to run.<br>
0a50: 0d 0a 54 6f 20 6d 61 6b 65 20 74 68 69 6e 67 73 ..To make things
0a60: 20 65 76 65 6e 20 77 6f 72 73 74 2c 20 74 68 69 even worst, thi
0a70: 73 20 73 63 68 65 6d 61 20 77 6f 72 6b 73 20 6e s schema works n
0a80: 69 63 65 6c 79 20 6f 6e 20 4c 69 6e 75 78 2c 20 icely on Linux,
0a90: 55 6e 69 78 20 61 6e 64 20 4d 61 63 20 4f 53 20 Unix and Mac OS
0aa0: 58 3b 20 62 75 74 20 6f 6e 20 57 69 6e 64 6f 77 X; but on Window
0ab0: 73 20 69 74 27 73 20 70 6c 61 67 75 65 64 20 62 s it's plagued b
0ac0: 79 20 6d 61 6e 79 20 73 65 72 69 6f 75 73 20 69 y many serious i
0ad0: 73 73 75 65 73 20 28 74 68 65 20 69 6e 66 61 6d ssues (the infam
0ae0: 6f 75 73 20 3c 62 3e 3c 69 3e 44 4c 4c 20 68 65 ous <b><i>DLL he
0af0: 6c 6c 3c 2f 69 3e 3c 2f 62 3e 29 2e 3c 2f 6c 69 ll</i></b>).</li
0b00: 3e 0d 0a 3c 6c 69 3e 75 73 69 6e 67 20 72 65 61 >..<li>using rea
0b10: 6c 20 3c 62 3e 3c 69 3e 64 79 6e 61 6d 69 63 20 l <b><i>dynamic
0b20: 6c 69 6e 6b 61 67 65 3c 2f 69 3e 3c 2f 62 3e 20 linkage</i></b>
0b30: 61 6b 61 20 3c 62 3e 3c 69 3e 6c 61 74 65 20 62 aka <b><i>late b
0b40: 69 6e 64 69 6e 67 3c 2f 69 3e 3c 2f 62 3e 20 28 inding</i></b> (
0b50: 77 68 69 63 68 20 68 61 73 6e 27 74 20 74 6f 20 which hasn't to
0b60: 62 65 20 63 6f 6e 66 75 73 65 64 20 77 69 74 68 be confused with
0b70: 20 73 69 6d 70 6c 79 20 75 73 69 6e 67 20 73 68 simply using sh
0b80: 61 72 65 64 20 6c 69 62 72 61 72 69 65 73 29 2e ared libraries).
0b90: 3c 62 72 3e 0d 0a 46 6f 6c 6c 6f 77 69 6e 67 20 <br>..Following
0ba0: 74 68 69 73 20 74 68 69 72 64 20 61 70 70 72 6f this third appro
0bb0: 61 63 68 20 61 6e 20 65 78 74 65 6e 73 69 6f 6e ach an extension
0bc0: 20 6d 6f 64 75 6c 65 20 63 6f 75 6c 64 20 62 65 module could be
0bd0: 20 73 65 6c 65 63 74 69 76 65 6c 79 20 6c 6f 61 selectively loa
0be0: 64 65 64 20 6f 72 20 6e 6f 74 20 61 6e 64 20 74 ded or not and t
0bf0: 68 65 20 61 63 74 75 61 6c 20 61 63 74 69 6f 6e he actual action
0c00: 20 77 69 6c 6c 20 62 65 20 61 63 74 69 76 61 74 will be activat
0c10: 65 64 20 6f 6e 6c 79 20 61 74 20 72 75 6e 2d 74 ed only at run-t
0c20: 69 6d 65 2e 0d 0a 49 66 20 66 6f 72 20 61 6e 79 ime...If for any
0c30: 20 72 65 61 73 6f 6e 20 74 68 65 20 6d 61 69 6e reason the main
0c40: 20 65 78 65 63 75 74 61 62 6c 65 20 66 61 69 6c executable fail
0c50: 73 20 74 6f 20 6c 6f 61 64 20 61 6e 20 65 76 65 s to load an eve
0c60: 6e 74 75 61 6c 20 65 78 74 65 6e 73 69 6f 6e 20 ntual extension
0c70: 6d 6f 64 75 6c 65 2c 20 69 74 20 77 69 6c 6c 20 module, it will
0c80: 73 74 69 6c 6c 20 63 6f 6e 74 69 6e 75 65 20 74 still continue t
0c90: 6f 20 77 6f 72 6b 20 62 79 20 73 69 6d 70 6c 79 o work by simply
0ca0: 20 69 6e 67 6f 72 69 6e 67 20 65 76 65 72 79 20 ingoring every
0cb0: 6f 70 74 69 6f 6e 61 6c 20 66 65 61 74 75 72 65 optional feature
0cc0: 20 72 65 71 75 69 72 69 6e 67 20 74 68 65 20 66 requiring the f
0cd0: 61 69 6c 69 6e 67 20 6d 6f 64 75 6c 65 2e 3c 62 ailing module.<b
0ce0: 72 3e 0d 0a 41 73 20 61 20 64 69 72 65 63 74 20 r>..As a direct
0cf0: 63 6f 6e 73 65 71 75 65 6e 63 65 2c 20 61 6e 20 consequence, an
0d00: 65 78 65 63 75 74 61 62 6c 65 20 62 75 69 6c 74 executable built
0d10: 20 74 68 69 73 20 77 61 79 20 63 61 6e 20 74 68 this way can th
0d20: 65 6f 72 65 74 69 63 61 6c 6c 79 20 67 72 6f 77 eoretically grow
0d30: 74 68 20 74 6f 20 74 68 65 20 69 6e 66 69 6e 69 th to the infini
0d40: 74 65 2c 20 61 6e 64 20 63 61 6e 20 70 72 61 63 te, and can prac
0d50: 74 69 63 61 6c 6c 79 20 69 67 6e 6f 72 65 20 61 tically ignore a
0d60: 6e 79 20 73 70 65 63 69 66 69 63 20 64 65 74 61 ny specific deta
0d70: 69 6c 20 61 62 6f 75 74 20 74 68 65 20 6f 70 74 il about the opt
0d80: 69 6f 6e 61 6c 20 66 65 61 74 75 72 65 73 20 73 ional features s
0d90: 75 70 70 6f 72 74 65 64 20 62 79 20 69 74 73 20 upported by its
0da0: 65 78 74 65 6e 73 69 6f 6e 73 3b 20 74 68 69 73 extensions; this
0db0: 20 63 6f 72 72 65 73 70 6f 6e 64 73 20 74 6f 20 corresponds to
0dc0: 74 68 65 20 73 6f 20 63 61 6c 6c 65 64 20 3c 62 the so called <b
0dd0: 3e 3c 69 3e 70 6c 75 67 2d 69 6e 3c 2f 69 3e 3c ><i>plug-in</i><
0de0: 2f 62 3e 20 61 72 63 68 69 74 65 63 74 75 72 65 /b> architecture
0df0: 2e 3c 62 72 3e 0d 0a 48 61 70 70 69 6c 79 20 65 .<br>..Happily e
0e00: 6e 6f 75 67 68 20 53 51 4c 69 74 65 33 20 66 75 nough SQLite3 fu
0e10: 6c 6c 79 20 73 75 70 70 6f 72 74 73 20 74 68 69 lly supports thi
0e20: 73 20 6d 6f 72 65 20 61 64 76 61 6e 63 65 64 20 s more advanced
0e30: 6d 65 63 68 61 6e 69 73 6d 3b 20 61 6e 64 20 74 mechanism; and t
0e40: 68 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 77 69 his option is wi
0e50: 64 65 6c 79 20 73 75 70 70 6f 72 74 65 64 20 62 dely supported b
0e60: 79 20 6d 61 6e 79 20 6c 61 6e 67 75 61 67 65 20 y many language
0e70: 63 6f 6e 6e 65 63 74 6f 72 73 2e 3c 2f 6c 69 3e connectors.</li>
0e80: 0d 0a 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 ..</li>..</ul><b
0e90: 72 3e 0d 0a 3c 68 33 3e 48 6f 77 20 69 74 20 77 r>..<h3>How it w
0ea0: 6f 72 6b 73 3c 2f 68 33 3e 0d 0a 3c 69 3e 6c 69 orks</h3>..<i>li
0eb0: 62 73 71 6c 69 74 65 33 3c 2f 69 3e 20 68 61 73 bsqlite3</i> has
0ec0: 20 74 68 65 20 63 61 70 61 62 69 6c 69 74 79 20 the capability
0ed0: 74 6f 20 64 79 6e 61 6d 69 63 61 6c 6c 79 20 6c to dynamically l
0ee0: 6f 61 64 20 65 78 74 65 6e 73 69 6f 6e 20 6d 6f oad extension mo
0ef0: 64 75 6c 65 73 2e 20 54 68 69 73 20 66 65 61 74 dules. This feat
0f00: 75 72 65 20 69 73 20 61 76 61 69 6c 61 62 6c 65 ure is available
0f10: 20 61 73 20 61 20 43 2d 6c 61 6e 67 75 61 67 65 as a C-language
0f20: 20 41 50 49 2c 20 62 75 74 20 69 73 20 61 76 61 API, but is ava
0f30: 69 62 6c 65 73 20 61 73 20 61 20 3c 69 3e 73 70 ibles as a <i>sp
0f40: 65 63 69 61 6c 3c 2f 69 3e 20 53 51 4c 20 66 75 ecial</i> SQL fu
0f50: 6e 63 74 69 6f 6e 20 61 73 20 77 65 6c 6c 3a 0d nction as well:.
0f60: 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c .<verbatim>..SEL
0f70: 45 43 54 20 6c 6f 61 64 5f 65 78 74 65 6e 73 69 ECT load_extensi
0f80: 6f 6e 28 27 6d 6f 64 5f 73 70 61 74 69 61 6c 69 on('mod_spatiali
0f90: 74 65 27 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 te');..</verbati
0fa0: 6d 3e 0d 0a 54 68 69 73 20 53 51 4c 20 66 75 6e m>..This SQL fun
0fb0: 63 74 69 6f 6e 20 6d 61 6b 65 20 65 6c 65 6d 65 ction make eleme
0fc0: 6e 74 61 72 79 20 73 69 6d 70 6c 65 20 28 61 6e ntary simple (an
0fd0: 64 20 6c 61 6e 67 75 61 67 65 20 69 6e 64 65 70 d language indep
0fe0: 65 6e 64 65 6e 74 29 20 74 68 65 20 70 72 6f 62 endent) the prob
0ff0: 6c 65 6d 20 6f 66 20 6c 6f 61 64 69 6e 67 20 61 lem of loading a
1000: 6e 79 20 70 6f 73 73 69 62 6c 65 20 65 78 74 65 ny possible exte
1010: 6e 73 69 6f 6e 3b 20 79 6f 75 20 61 72 65 20 73 nsion; you are s
1020: 69 6d 70 6c 79 20 65 78 70 65 63 74 65 64 20 74 imply expected t
1030: 6f 20 65 78 65 63 75 74 65 20 61 20 72 61 74 68 o execute a rath
1040: 65 72 20 74 72 69 76 69 61 6c 20 53 51 4c 20 73 er trivial SQL s
1050: 74 61 74 65 6d 65 6e 74 20 69 6e 20 6f 72 64 65 tatement in orde
1060: 72 20 74 6f 20 6c 6f 61 64 20 61 6e 20 65 78 74 r to load an ext
1070: 65 72 6e 61 6c 20 65 78 74 65 6e 73 69 6f 6e 20 ernal extension
1080: 77 68 65 6e 20 69 74 27 73 20 61 63 74 75 61 6c when it's actual
1090: 6c 79 20 72 65 71 75 69 72 65 64 2e 3c 62 72 3e ly required.<br>
10a0: 3c 62 72 3e 0d 0a 4c 6f 61 64 61 62 6c 65 20 65 <br>..Loadable e
10b0: 78 74 65 6e 73 69 6f 6e 20 61 6e 61 74 68 6f 6d xtension anathom
10c0: 79 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 61 6e y:..<ul>..<li>an
10d0: 79 20 53 51 4c 69 74 65 20 65 78 74 65 6e 73 69 y SQLite extensi
10e0: 6f 6e 20 6d 6f 64 75 6c 65 20 69 73 20 65 78 70 on module is exp
10f0: 65 63 74 65 64 20 74 6f 20 64 65 63 6c 61 72 65 ected to declare
1100: 20 61 20 63 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 a conventional
1110: 69 6e 74 65 72 66 61 63 65 2e 3c 62 72 3e 0d 0a interface.<br>..
1120: 45 78 63 65 70 74 20 66 6f 72 20 74 68 69 73 2c Except for this,
1130: 20 61 6e 79 20 53 51 4c 69 74 65 27 73 20 6f 77 any SQLite's ow
1140: 6e 20 65 78 74 65 6e 73 69 6f 6e 20 73 69 6d 70 n extension simp
1150: 6c 79 20 69 73 20 61 6e 20 6f 72 64 69 6e 61 72 ly is an ordinar
1160: 79 20 73 68 61 72 65 64 20 6c 69 62 72 61 72 79 y shared library
1170: 20 6f 72 20 44 4c 4c 20 61 73 20 61 6e 79 20 6f or DLL as any o
1180: 74 68 65 72 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e ther.</li>..<li>
1190: 61 20 72 65 61 6c 20 65 78 74 65 6e 73 69 6f 6e a real extension
11a0: 20 6d 6f 64 75 6c 65 20 77 69 6c 6c 20 6e 65 76 module will nev
11b0: 65 72 20 65 78 70 6c 69 63 69 74 6c 79 20 64 65 er explicitly de
11c0: 70 65 6e 64 20 6f 6e 20 53 51 4c 69 74 65 33 2c pend on SQLite3,
11d0: 20 62 65 63 61 75 73 65 20 74 68 65 20 66 6f 6c because the fol
11e0: 6c 6f 77 69 6e 67 20 61 63 74 69 6f 6e 73 20 77 lowing actions w
11f0: 69 6c 6c 20 62 65 20 61 75 74 6f 6d 61 74 69 63 ill be automatic
1200: 61 6c 6c 79 20 74 61 6b 65 6e 20 62 79 20 53 51 ally taken by SQ
1210: 4c 69 74 65 33 20 77 68 65 6e 20 6c 6f 61 64 69 Lite3 when loadi
1220: 6e 67 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 61 ng:..<ul>..<li>a
1230: 6c 6c 20 53 51 4c 20 66 75 63 74 69 6f 6e 73 20 ll SQL fuctions
1240: 64 65 66 69 6e 65 64 2f 73 75 70 70 6f 72 74 65 defined/supporte
1250: 64 20 62 79 20 74 68 65 20 65 78 74 65 6e 73 69 d by the extensi
1260: 6f 6e 20 77 69 6c 6c 20 62 65 20 61 64 64 65 64 on will be added
1270: 20 74 6f 20 74 68 65 20 73 74 61 6e 64 61 72 64 to the standard
1280: 20 6c 69 73 74 3b 20 61 6e 64 20 65 76 65 6e 74 list; and event
1290: 75 61 6c 6c 79 20 61 6e 20 65 78 74 65 6e 73 69 ually an extensi
12a0: 6f 6e 20 63 6f 75 6c 64 20 65 76 65 72 20 6f 76 on could ever ov
12b0: 65 72 6c 6f 61 64 20 61 6e 79 20 70 72 65 2d 64 erload any pre-d
12c0: 65 66 69 6e 65 64 20 53 51 4c 20 66 75 6e 63 74 efined SQL funct
12d0: 69 6f 6e 20 64 69 72 65 63 74 6c 79 20 64 65 66 ion directly def
12e0: 69 6e 65 64 20 62 79 20 53 51 4c 69 74 65 33 2e ined by SQLite3.
12f0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 61 74 27 </li>..<li>that'
1300: 73 20 6e 6f 74 20 61 6c 6c 3b 20 53 51 4c 69 74 s not all; SQLit
1310: 65 33 20 77 69 6c 6c 20 69 6d 70 6c 69 63 69 74 e3 will implicit
1320: 6c 79 20 70 61 73 73 20 74 6f 20 74 68 65 20 65 ly pass to the e
1330: 78 74 65 6e 73 69 6f 6e 20 61 20 3c 69 3e 3c 75 xtension a <i><u
1340: 3e 6d 69 72 72 6f 72 20 63 6f 70 79 3c 2f 75 3e >mirror copy</u>
1350: 3c 2f 69 3e 20 6f 66 20 69 74 73 20 6f 77 6e 20 </i> of its own
1360: 41 50 49 73 3a 20 74 68 69 73 20 77 69 6c 6c 20 APIs: this will
1370: 65 6e 73 75 72 65 20 74 68 61 74 20 65 78 61 63 ensure that exac
1380: 74 6c 79 20 74 68 65 20 73 61 6d 65 20 63 6f 64 tly the same cod
1390: 65 20 77 69 6c 6c 20 73 75 70 70 6f 72 74 20 62 e will support b
13a0: 6f 74 68 20 74 68 65 20 53 51 4c 69 74 65 27 73 oth the SQLite's
13b0: 20 6f 77 6e 20 63 6f 72 65 20 61 6e 64 20 74 68 own core and th
13c0: 65 20 65 78 74 65 6e 73 69 6f 6e 2c 20 61 6e 64 e extension, and
13d0: 20 77 69 6c 6c 20 65 66 66 65 63 74 69 76 65 6c will effectivel
13e0: 79 20 61 76 6f 69 64 20 61 6e 79 20 70 6f 73 73 y avoid any poss
13f0: 69 62 6c 65 20 63 6f 6e 66 6c 69 63 74 20 62 65 ible conflict be
1400: 74 77 65 65 6e 20 74 68 65 6d 2e 3c 2f 6c 69 3e tween them.</li>
1410: 20 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c ..</ul></li>..<
1420: 2f 75 6c 3e 0d 0a 3c 62 72 3e 0d 0a 43 6f 6d 6d /ul>..<br>..Comm
1430: 6f 6e 20 66 61 69 6c 75 72 65 20 63 61 75 73 65 on failure cause
1440: 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 69 66 s:..<ul>..<li>if
1450: 20 74 68 65 20 65 78 70 65 63 74 65 64 20 63 6f the expected co
1460: 6e 76 65 6e 74 69 6f 6e 61 6c 20 69 6e 74 65 72 nventional inter
1470: 66 61 63 65 20 69 73 6e 27 74 20 63 6f 72 72 65 face isn't corre
1480: 63 74 6c 79 20 64 65 63 6c 61 72 65 64 20 62 79 ctly declared by
1490: 20 74 68 65 20 73 68 61 72 65 64 20 6c 69 62 72 the shared libr
14a0: 61 72 79 20 62 65 69 6e 67 20 6c 6f 61 64 65 64 ary being loaded
14b0: 2c 20 74 68 65 6e 20 53 51 4c 69 74 65 33 20 77 , then SQLite3 w
14c0: 69 6c 6c 20 73 69 6d 70 6c 79 20 61 73 73 75 6d ill simply assum
14d0: 65 20 74 68 61 74 20 69 74 27 73 20 6e 6f 74 20 e that it's not
14e0: 61 20 76 61 6c 69 64 20 65 78 74 65 6e 73 69 6f a valid extensio
14f0: 6e 20 6d 6f 64 75 6c 65 2e 3c 62 72 3e 0d 0a 41 n module.<br>..A
1500: 6e 64 20 63 6f 6e 73 65 71 75 65 6e 74 6c 79 20 nd consequently
1510: 77 69 6c 6c 20 72 65 66 75 73 65 20 74 6f 20 6c will refuse to l
1520: 6f 61 64 20 74 68 65 20 6d 6f 64 75 6c 65 20 77 oad the module w
1530: 69 74 68 6f 75 74 20 61 6e 79 20 6f 74 68 65 72 ithout any other
1540: 20 63 6f 6e 73 65 71 75 65 6e 63 65 20 28 65 78 consequence (ex
1550: 63 65 70 74 20 6d 61 79 20 62 65 20 70 72 69 6e cept may be prin
1560: 74 69 6e 67 20 73 6f 6d 65 20 61 70 70 72 6f 70 ting some approp
1570: 72 69 61 74 65 20 65 72 72 6f 72 20 6d 65 73 73 riate error mess
1580: 61 67 65 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e age).</li>..<li>
1590: 61 20 6d 6f 72 65 20 6f 62 76 69 6f 75 73 20 66 a more obvious f
15a0: 61 69 6c 75 72 65 20 63 61 75 73 65 20 63 6f 75 ailure cause cou
15b0: 6c 64 20 62 65 20 74 68 65 20 6f 6e 65 20 74 6f ld be the one to
15c0: 20 61 74 74 65 6d 70 74 20 6c 6f 61 64 69 6e 67 attempt loading
15d0: 20 61 20 6e 6f 74 20 65 78 69 73 74 69 6e 67 20 a not existing
15e0: 6d 6f 64 75 6c 65 20 28 6f 72 20 70 6f 73 73 69 module (or possi
15f0: 62 6c 79 2c 20 61 20 6d 6f 64 75 6c 65 20 77 68 bly, a module wh
1600: 6f 6d 20 61 63 74 75 61 6c 20 61 64 64 72 65 73 om actual addres
1610: 73 20 63 6f 75 6c 64 6e 27 74 20 62 65 20 72 65 s couldn't be re
1620: 73 6f 6c 76 65 64 20 62 79 20 61 70 70 6c 79 69 solved by applyi
1630: 6e 67 20 74 68 65 20 73 74 61 6e 64 61 72 64 20 ng the standard
1640: 73 79 73 74 65 6d 2d 64 65 70 65 6e 64 65 6e 74 system-dependent
1650: 20 73 65 61 63 68 20 72 75 6c 65 73 29 2e 3c 2f seach rules).</
1660: 6c 69 3e 20 0d 0a 3c 6c 69 3e 66 69 6e 61 6c 6c li> ..<li>finall
1670: 79 2c 20 74 68 65 20 6d 6f 64 75 6c 65 20 63 6f y, the module co
1680: 75 6c 64 20 65 66 66 65 63 74 69 76 65 6c 79 20 uld effectively
1690: 65 78 69 73 74 73 20 61 6e 64 20 63 6f 75 6c 64 exists and could
16a0: 20 63 6f 72 72 65 63 74 6c 79 20 64 65 63 6c 61 correctly decla
16b0: 72 65 20 61 20 76 61 6c 69 64 20 63 6f 6e 76 65 re a valid conve
16c0: 6e 74 69 6f 6e 61 6c 20 69 6e 74 65 72 66 61 63 ntional interfac
16d0: 65 2e 20 41 6e 79 77 61 79 2c 20 69 66 20 74 68 e. Anyway, if th
16e0: 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 e corresponding
16f0: 73 68 61 72 65 64 20 6c 69 62 72 61 72 79 20 68 shared library h
1700: 61 73 20 66 75 72 74 68 65 72 20 64 65 70 65 6e as further depen
1710: 64 65 63 69 65 73 20 73 6f 6d 65 20 62 72 6f 6b decies some brok
1720: 65 6e 20 6c 69 6e 6b 20 63 6f 75 6c 64 20 70 6f en link could po
1730: 73 73 69 62 6c 79 20 66 6f 72 62 69 64 20 61 20 ssibly forbid a
1740: 73 75 63 63 65 73 66 75 6c 20 6c 6f 61 64 69 6e succesful loadin
1750: 67 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 g.</li>..<li>the
1760: 20 6c 61 73 74 20 68 69 6c 6c 2d 66 61 74 65 64 last hill-fated
1770: 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 3a 20 53 51 combination: SQ
1780: 4c 69 74 65 33 20 69 73 20 61 20 73 74 72 6f 6e Lite3 is a stron
1790: 67 6c 79 20 63 6f 6e 66 69 67 75 72 61 62 6c 65 gly configurable
17a0: 20 63 6f 6d 70 6f 6e 65 6e 74 2e 20 49 66 20 66 component. If f
17b0: 6f 72 20 61 6e 79 20 68 69 67 68 6c 79 20 6f 70 or any highly op
17c0: 69 6e 61 62 6c 65 20 63 68 6f 69 63 65 20 79 6f inable choice yo
17d0: 75 72 20 73 79 73 74 65 6d 20 70 61 63 6b 61 67 ur system packag
17e0: 65 73 20 68 61 64 20 64 65 63 69 64 65 64 20 74 es had decided t
17f0: 6f 20 64 69 73 61 62 6c 65 20 61 74 20 61 6c 6c o disable at all
1800: 20 74 68 65 20 65 78 74 65 6e 73 69 6f 6e 20 6d the extension m
1810: 6f 64 75 6c 65 20 6d 65 63 68 61 6d 69 73 6d 20 odule mechamism
1820: 79 6f 75 27 6c 6c 20 74 68 65 6e 20 6e 65 76 65 you'll then neve
1830: 72 20 62 65 20 61 62 6c 65 20 74 6f 20 6c 6f 61 r be able to loa
1840: 64 20 61 6e 79 20 65 78 74 65 6e 73 69 6f 6e 2e d any extension.
1850: 20 46 75 6c 6c 20 73 74 6f 70 2e 20 28 61 6e 79 Full stop. (any
1860: 77 61 79 20 79 6f 75 27 6c 6c 20 70 72 6f 62 61 way you'll proba
1870: 62 6c 79 20 62 65 20 61 62 6c 65 20 74 6f 20 73 bly be able to s
1880: 77 69 74 63 68 20 74 6f 20 73 6f 6d 65 20 6d 6f witch to some mo
1890: 72 65 20 72 65 61 73 6f 62 6c 65 20 2f 20 6c 65 re reasoble / le
18a0: 73 73 20 70 61 72 61 6e 6f 69 64 20 64 69 73 74 ss paranoid dist
18b0: 72 69 62 75 74 69 6f 6e 29 2e 0d 0a 3c 2f 75 6c ribution)...</ul
18c0: 3e 0d 0a 3c 68 33 3e 57 68 61 74 27 73 20 6e 65 >..<h3>What's ne
18d0: 77 20 69 6e 20 3c 75 3e 3c 69 3e 6d 6f 64 5f 73 w in <u><i>mod_s
18e0: 70 61 74 69 61 6c 69 74 65 3c 2f 69 3e 3c 2f 75 patialite</i></u
18f0: 3e 3c 2f 68 33 3e 0d 0a 59 6f 75 27 6c 6c 20 70 ></h3>..You'll p
1900: 72 6f 62 61 62 6c 79 20 62 65 20 61 6c 72 65 61 robably be alrea
1910: 64 79 20 61 63 63 75 73 74 6f 6d 65 64 20 74 6f dy accustomed to
1920: 20 6c 6f 61 64 20 53 70 61 74 69 61 4c 69 74 65 load SpatiaLite
1930: 20 61 73 20 61 20 64 79 6e 61 6d 69 63 20 65 78 as a dynamic ex
1940: 74 65 6e 73 69 6f 6e 3b 20 62 75 74 20 61 6e 79 tension; but any
1950: 20 70 72 65 76 69 6f 75 73 20 76 65 72 73 69 6f previous versio
1960: 6e 20 62 65 66 6f 72 65 20 3c 62 3e 34 2e 32 3c n before <b>4.2<
1970: 2f 62 3e 20 6d 61 64 65 20 6e 6f 20 72 65 61 6c /b> made no real
1980: 20 64 69 73 74 69 6e 63 74 69 6f 6e 20 62 65 74 distinction bet
1990: 77 65 65 6e 20 6c 6f 61 64 61 62 6c 65 20 6d 6f ween loadable mo
19a0: 64 75 6c 65 73 20 61 6e 64 20 67 65 6e 65 72 61 dules and genera
19b0: 6c 2d 70 75 72 70 6f 73 65 20 73 68 61 72 65 64 l-purpose shared
19c0: 20 6c 69 62 72 61 72 69 65 73 2e 3c 62 72 3e 0d libraries.<br>.
19d0: 0a 41 73 20 77 65 20 70 61 69 6e 66 75 6c 6c 79 .As we painfully
19e0: 20 6c 65 61 72 6e 65 64 20 62 79 20 64 69 72 65 learned by dire
19f0: 63 74 20 6f 6e 2d 74 68 65 2d 66 69 65 6c 64 20 ct on-the-field
1a00: 65 78 70 65 72 69 65 6e 63 65 2c 20 74 68 69 73 experience, this
1a10: 20 61 70 70 61 72 65 6e 74 6c 79 20 73 69 6d 70 apparently simp
1a20: 6c 65 72 20 63 6f 6e 66 69 67 75 72 61 74 69 6f ler configuratio
1a30: 6e 20 63 61 75 73 65 64 20 6c 6f 74 20 6f 66 20 n caused lot of
1a40: 74 72 6f 75 62 6c 65 73 3a 20 69 6e 73 74 61 62 troubles: instab
1a50: 69 6c 69 74 69 65 73 2c 20 73 75 64 64 65 6e 20 ilities, sudden
1a60: 63 72 61 73 68 65 73 20 61 6e 64 20 73 6f 20 6f crashes and so o
1a70: 6e 2e 20 4d 61 6b 69 6e 67 20 61 20 63 6c 65 61 n. Making a clea
1a80: 72 65 72 20 64 69 73 74 69 6e 63 74 69 6f 6e 20 rer distinction
1a90: 62 65 74 77 65 65 6e 20 61 20 3c 75 3e 3c 69 3e between a <u><i>
1aa0: 67 65 6e 65 72 61 6c 2d 70 75 72 70 6f 73 65 20 general-purpose
1ab0: 73 68 61 72 65 64 20 6c 69 62 72 61 72 79 3c 2f shared library</
1ac0: 69 3e 3c 2f 75 3e 20 61 6e 64 20 61 20 3c 75 3e i></u> and a <u>
1ad0: 3c 69 3e 70 75 72 65 20 6c 6f 61 64 61 62 6c 65 <i>pure loadable
1ae0: 20 6d 6f 64 75 6c 65 3c 2f 69 3e 3c 2f 62 3e 20 module</i></b>
1af0: 73 65 65 6d 73 20 74 6f 20 62 65 20 74 68 65 20 seems to be the
1b00: 64 65 66 69 6e 69 74 69 76 65 20 73 6f 6c 75 74 definitive solut
1b10: 69 6f 6e 2e 3c 62 72 3e 0d 0a 45 78 61 63 74 6c ion.<br>..Exactl
1b20: 79 20 68 65 72 65 20 69 73 20 74 68 65 20 72 61 y here is the ra
1b30: 64 69 63 61 6c 20 69 6e 6e 6f 76 61 74 69 6f 6e dical innovation
1b40: 20 69 6e 74 72 6f 64 75 63 65 20 73 74 61 72 74 introduce start
1b50: 69 6e 67 20 73 69 6e 63 65 20 76 65 72 73 69 6f ing since versio
1b60: 6e 20 3c 62 3e 34 2e 32 3c 2f 62 3e 3b 20 6e 6f n <b>4.2</b>; no
1b70: 77 20 53 70 61 74 69 61 4c 69 74 65 20 69 73 20 w SpatiaLite is
1b80: 64 69 73 74 72 69 62 75 74 65 64 20 69 6e 20 74 distributed in t
1b90: 77 6f 20 61 6c 74 65 72 6e 61 74 69 76 65 20 66 wo alternative f
1ba0: 6c 61 76 6f 72 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c lavors:..<ul>..<
1bb0: 6c 69 3e 3c 62 3e 3c 69 3e 6c 69 62 73 70 61 74 li><b><i>libspat
1bc0: 69 61 6c 69 74 65 3c 2f 69 3e 3c 2f 62 3e 20 28 ialite</i></b> (
1bd0: 3c 62 3e 3c 69 3e 2e 73 6f 3c 2f 69 3e 3c 2f 62 <b><i>.so</i></b
1be0: 3e 2c 20 3c 62 3e 3c 69 3e 2e 64 6c 6c 3c 2f 69 >, <b><i>.dll</i
1bf0: 3e 3c 2f 62 3e 2c 20 3c 62 3e 3c 69 3e 2e 64 79 ></b>, <b><i>.dy
1c00: 6c 69 62 3c 2f 69 3e 3c 2f 62 3e 20 61 6e 64 20 lib</i></b> and
1c10: 73 6f 20 6f 6e 29 3a 20 61 20 67 65 6e 75 69 6e so on): a genuin
1c20: 65 20 63 6c 61 73 73 69 63 20 73 68 61 72 65 64 e classic shared
1c30: 20 6c 69 62 72 61 72 79 2e 3c 62 72 3e 0d 0a 49 library.<br>..I
1c40: 74 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 64 65 t will always de
1c50: 70 65 6e 64 20 6f 6e 20 73 6f 6d 65 20 65 78 74 pend on some ext
1c60: 65 72 6e 61 6c 20 3c 69 3e 6c 69 62 73 71 6c 69 ernal <i>libsqli
1c70: 74 65 33 3c 2f 69 3e 2c 20 61 6e 64 20 69 73 20 te3</i>, and is
1c80: 75 6e 69 71 75 65 6c 79 20 69 6e 74 65 6e 64 65 uniquely intende
1c90: 64 20 74 6f 20 62 65 20 75 73 65 64 20 62 79 20 d to be used by
1ca0: 73 74 61 6e 64 2d 61 6c 6f 6e 65 20 61 70 70 6c stand-alone appl
1cb0: 69 63 61 74 69 6f 6e 73 20 28 73 75 63 68 20 61 ications (such a
1cc0: 73 20 65 2e 67 2e 20 3c 62 3e 3c 69 3e 73 70 61 s e.g. <b><i>spa
1cd0: 74 69 61 6c 69 74 65 3c 2f 69 3e 3c 2f 62 3e 20 tialite</i></b>
1ce0: 6f 72 20 3c 62 3e 3c 69 3e 73 70 61 74 69 61 6c or <b><i>spatial
1cf0: 69 74 65 5f 67 75 69 3c 2f 75 3e 3c 2f 62 3e 29 ite_gui</u></b>)
1d00: 2e 3c 62 72 3e 0d 0a 59 6f 75 27 6c 6c 20 6e 65 .<br>..You'll ne
1d10: 76 65 72 20 62 65 20 61 62 6c 65 20 74 6f 20 73 ver be able to s
1d20: 75 63 63 65 73 66 75 6c 6c 79 20 6c 6f 61 64 20 uccesfully load
1d30: 74 68 69 73 20 3c 62 3e 3c 69 3e 6c 69 62 73 70 this <b><i>libsp
1d40: 61 74 69 61 6c 69 74 65 3c 2f 69 3e 3c 2f 62 3e atialite</i></b>
1d50: 20 73 68 61 72 65 64 20 6c 69 62 72 61 72 79 20 shared library
1d60: 61 73 20 61 20 64 79 6e 61 6d 69 63 20 65 78 74 as a dynamic ext
1d70: 65 6e 73 69 6f 6e 20 76 69 61 20 74 68 65 20 3c ension via the <
1d80: 62 3e 53 45 4c 45 43 54 20 6c 6f 61 64 5f 65 78 b>SELECT load_ex
1d90: 74 65 6e 73 69 6f 6e 3c 2f 62 3e 20 6d 65 63 68 tension</b> mech
1da0: 61 6e 69 73 6d 2c 20 73 69 6d 70 6c 79 20 62 65 anism, simply be
1db0: 63 61 75 73 65 20 69 74 20 64 6f 65 73 6e 27 74 cause it doesn't
1dc0: 20 64 65 63 6c 61 72 65 20 74 68 65 20 72 65 71 declare the req
1dd0: 75 69 72 65 64 20 63 6f 6e 76 65 6e 74 69 6f 6e uired convention
1de0: 61 6c 20 69 6e 74 65 72 66 61 63 65 2e 3c 2f 6c al interface.</l
1df0: 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 3c 69 3e 6d 6f i>..<li><b><i>mo
1e00: 64 5f 73 70 61 74 69 61 6c 69 74 65 3c 2f 69 3e d_spatialite</i>
1e10: 3c 2f 62 3e 20 28 3c 62 3e 3c 69 3e 2e 73 6f 3c </b> (<b><i>.so<
1e20: 2f 69 3e 3c 2f 62 3e 2c 20 3c 62 3e 3c 69 3e 2e /i></b>, <b><i>.
1e30: 64 6c 6c 3c 2f 69 3e 3c 2f 62 3e 2c 20 3c 62 3e dll</i></b>, <b>
1e40: 3c 69 3e 2e 64 79 6c 69 62 3c 2f 69 3e 3c 2f 62 <i>.dylib</i></b
1e50: 3e 20 61 6e 64 20 73 6f 20 6f 6e 29 3a 20 74 68 > and so on): th
1e60: 69 73 20 69 73 20 73 69 6d 70 6c 79 20 69 6e 74 is is simply int
1e70: 65 6e 64 65 64 20 61 73 20 70 75 72 65 20 6c 6f ended as pure lo
1e80: 61 64 61 62 6c 65 20 6d 6f 64 75 6c 65 20 6c 61 adable module la
1e90: 63 6b 69 6e 67 20 61 6e 79 20 65 78 70 6c 69 63 cking any explic
1ea0: 69 74 20 53 51 4c 69 74 65 33 20 64 65 70 65 6e it SQLite3 depen
1eb0: 64 65 6e 63 79 2e 3c 62 72 3e 0d 0a 59 6f 75 20 dency.<br>..You
1ec0: 6e 65 76 65 72 20 62 65 20 61 62 6c 65 20 74 6f never be able to
1ed0: 20 64 69 72 65 63 74 6c 79 20 6c 69 6e 6b 20 74 directly link t
1ee0: 68 69 73 20 3c 62 3e 3c 69 3e 6d 6f 64 5f 73 70 his <b><i>mod_sp
1ef0: 61 74 69 61 6c 69 74 65 3c 2f 69 3e 3c 2f 62 3e atialite</i></b>
1f00: 20 73 68 61 72 65 64 20 6c 69 62 72 61 72 79 20 shared library
1f10: 66 6f 6c 6c 6f 77 69 6e 67 20 74 68 65 20 63 6c following the cl
1f20: 61 73 73 69 63 20 77 61 79 2c 20 62 65 63 61 75 assic way, becau
1f30: 73 65 20 69 74 20 64 6f 65 73 6e 27 74 20 64 65 se it doesn't de
1f40: 63 6c 61 72 65 20 61 6e 79 20 65 78 74 65 72 6e clare any extern
1f50: 61 6c 20 6c 69 6e 6b 20 73 79 6d 62 6f 6c 20 65 al link symbol e
1f60: 78 63 65 70 74 20 74 68 61 74 20 74 68 65 20 63 xcept that the c
1f70: 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 69 6e 74 65 onventional inte
1f80: 72 66 61 63 65 2e 0d 0a 54 68 65 20 75 6e 69 71 rface...The uniq
1f90: 75 65 20 70 6f 73 73 69 62 6c 65 20 77 61 79 20 ue possible way
1fa0: 74 6f 20 6c 6f 61 64 20 61 6e 64 20 61 63 74 69 to load and acti
1fb0: 76 61 74 65 20 74 68 69 73 20 6d 6f 64 75 6c 65 vate this module
1fc0: 20 69 73 20 62 79 20 63 61 6c 6c 69 6e 67 20 61 is by calling a
1fd0: 20 3c 62 3e 53 45 4c 45 43 54 20 6c 6f 61 64 5f <b>SELECT load_
1fe0: 65 78 74 65 6e 73 69 6f 6e 3c 2f 62 3e 20 53 51 extension</b> SQ
1ff0: 4c 20 73 74 61 74 65 6d 65 6e 74 2e 3c 2f 6c 69 L statement.</li
2000: 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 68 72 3e 3c 62 >..</ul>..<hr><b
2010: 72 3e 0d 0a 62 61 63 6b 20 74 6f 20 3c 61 20 68 r>..back to <a h
2020: 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 ref="https://www
2030: 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 66 6f 73 .gaia-gis.it/fos
2040: 73 69 6c 2f 6c 69 62 73 70 61 74 69 61 6c 69 74 sil/libspatialit
2050: 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 34 2e 32 2e e/wiki?name=4.2.
2060: 30 2d 64 6f 63 22 3e 34 2e 32 2e 30 2d 64 6f 63 0-doc">4.2.0-doc
2070: 3c 2f 61 3e 0a 5a 20 38 62 62 33 37 39 61 63 37 </a>.Z 8bb379ac7
2080: 63 37 34 66 61 31 34 37 39 33 35 65 36 65 39 63 c74fa147935e6e9c
2090: 62 35 35 61 66 34 33 0a b55af43.