/ Changes On Branch stdcall-3.8.8
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch stdcall-3.8.8 Excluding Merge-Ins

This is equivalent to a diff from 9d6c1880fb to cbb93d1aa1

2015-03-25
00:09
Backport the 'stdcall' related enhancements from trunk. (Leaf check-in: cbb93d1aa1 user: mistachkin tags: stdcall-3.8.8)
2015-02-25
13:29
Version 3.8.8.3 (Leaf check-in: 9d6c1880fb user: drh tags: release, version-3.8.8.3, branch-3.8.8)
12:52
Add support for linenoise to shell.c. (check-in: ec27ab0eb3 user: dan tags: branch-3.8.8)

Changes to Makefile.msc.

    17     17   !ENDIF
    18     18   
    19     19   # Set this non-0 to enable full warnings (-W4, etc) when compiling.
    20     20   #
    21     21   !IFNDEF USE_FULLWARN
    22     22   USE_FULLWARN = 0
    23     23   !ENDIF
           24  +
           25  +# Set this non-0 to use "stdcall" calling convention for the core library
           26  +# and shell executable.
           27  +#
           28  +!IFNDEF USE_STDCALL
           29  +USE_STDCALL = 0
           30  +!ENDIF
           31  +
           32  +# Set this non-0 to have the shell executable link against the core dynamic
           33  +# link library.
           34  +#
           35  +!IFNDEF DYNAMIC_SHELL
           36  +DYNAMIC_SHELL = 0
           37  +!ENDIF
    24     38   
    25     39   # If necessary, create a list of harmless compiler warnings to disable when
    26         -# compiling the build tools.  For the SQLite source code itself, warnings,
           40  +# compiling the various tools.  For the SQLite source code itself, warnings,
    27     41   # if any, will be disabled from within it.
    28     42   #
    29     43   !IFNDEF NO_WARN
    30     44   !IF $(USE_FULLWARN)!=0
    31     45   NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4152 -wd4189 -wd4206 -wd4210
    32     46   NO_WARN = $(NO_WARN) -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
    33     47   !ENDIF
................................................................................
   246    260   
   247    261   NSDKLIBPATH = $(NSDKLIBPATH:\\=\)
   248    262   
   249    263   # C compiler and options for use in building executables that
   250    264   # will run on the platform that is doing the build.
   251    265   #
   252    266   !IF $(USE_FULLWARN)!=0
   253         -BCC = $(NCC) -W4
          267  +BCC = $(NCC) -nologo -W4
   254    268   !ELSE
   255         -BCC = $(NCC) -W3
          269  +BCC = $(NCC) -nologo -W3
   256    270   !ENDIF
   257    271   
   258    272   # Check if assembly code listings should be generated for the source
   259    273   # code files to be compiled.
   260    274   #
   261    275   !IF $(USE_LISTINGS)!=0
   262    276   BCC = $(BCC) -FAcs
................................................................................
   271    285   !ENDIF
   272    286   
   273    287   # C compiler and options for use in building executables that
   274    288   # will run on the target platform.  (BCC and TCC are usually the
   275    289   # same unless your are cross-compiling.)
   276    290   #
   277    291   !IF $(USE_FULLWARN)!=0
   278         -TCC = $(CC) -W4 -DINCLUDE_MSVC_H=1
          292  +TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1
   279    293   !ELSE
   280         -TCC = $(CC) -W3
          294  +TCC = $(CC) -nologo -W3
   281    295   !ENDIF
   282    296   
   283    297   TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src -fp:precise
   284    298   RCC = $(RC) -DSQLITE_OS_WIN=1 -I$(TOP) -I$(TOP)\src
          299  +
          300  +# Check if we want to use the "stdcall" calling convention when compiling.
          301  +# This is not supported by the compilers for non-x86 platforms.  It should
          302  +# also be noted here that building any target with these "stdcall" options
          303  +# will most likely fail if the Tcl library is also required.  This is due
          304  +# to how the Tcl library functions are declared and exported (i.e. without
          305  +# an explicit calling convention, which results in "cdecl").
          306  +#
          307  +!IF $(USE_STDCALL)!=0
          308  +!IF "$(PLATFORM)"=="x86"
          309  +CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
          310  +SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
          311  +!ELSE
          312  +!IFNDEF PLATFORM
          313  +CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
          314  +SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
          315  +!ELSE
          316  +CORE_CCONV_OPTS =
          317  +SHELL_CCONV_OPTS =
          318  +!ENDIF
          319  +!ENDIF
          320  +!ELSE
          321  +CORE_CCONV_OPTS =
          322  +SHELL_CCONV_OPTS =
          323  +!ENDIF
          324  +
          325  +# These are additional compiler options used for the core library.
          326  +#
          327  +!IFNDEF CORE_COMPILE_OPTS
          328  +!IF $(USE_STDCALL)!=0
          329  +CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport)
          330  +!ELSE
          331  +CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
          332  +!ENDIF
          333  +!ENDIF
          334  +
          335  +# These are the additional targets that the core library should depend on
          336  +# when linking.
          337  +#
          338  +!IFNDEF CORE_LINK_DEP
          339  +!IF $(USE_STDCALL)!=0
          340  +CORE_LINK_DEP =
          341  +!ELSE
          342  +CORE_LINK_DEP = sqlite3.def
          343  +!ENDIF
          344  +!ENDIF
          345  +
          346  +# These are additional linker options used for the core library.
          347  +#
          348  +!IFNDEF CORE_LINK_OPTS
          349  +!IF $(USE_STDCALL)!=0
          350  +CORE_LINK_OPTS =
          351  +!ELSE
          352  +CORE_LINK_OPTS = /DEF:sqlite3.def
          353  +!ENDIF
          354  +!ENDIF
          355  +
          356  +# These are additional compiler options used for the shell executable.
          357  +#
          358  +!IFNDEF SHELL_COMPILE_OPTS
          359  +!IF $(DYNAMIC_SHELL)!=0
          360  +SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) -DSQLITE_API=__declspec(dllimport)
          361  +!ELSE
          362  +SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS)
          363  +!ENDIF
          364  +!ENDIF
          365  +
          366  +# This is the core library that the shell executable should depend on.
          367  +#
          368  +!IFNDEF SHELL_CORE_DEP
          369  +!IF $(DYNAMIC_SHELL)!=0
          370  +SHELL_CORE_DEP = sqlite3.dll
          371  +!ELSE
          372  +SHELL_CORE_DEP = libsqlite3.lib
          373  +!ENDIF
          374  +!ENDIF
          375  +
          376  +# This is the core library that the shell executable should link with.
          377  +#
          378  +!IFNDEF SHELL_CORE_LIB
          379  +!IF $(DYNAMIC_SHELL)!=0
          380  +SHELL_CORE_LIB = sqlite3.lib
          381  +!ELSE
          382  +SHELL_CORE_LIB = libsqlite3.lib
          383  +!ENDIF
          384  +!ENDIF
          385  +
          386  +# These are additional linker options used for the shell executable.
          387  +#
          388  +!IFNDEF SHELL_LINK_OPTS
          389  +SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
          390  +!ENDIF
   285    391   
   286    392   # Check if assembly code listings should be generated for the source
   287    393   # code files to be compiled.
   288    394   #
   289    395   !IF $(USE_LISTINGS)!=0
   290    396   TCC = $(TCC) -FAcs
   291    397   !ENDIF
................................................................................
   565    671   LTLINK = $(TCC) -Fe$@
   566    672   
   567    673   # If a platform was set, force the linker to target that.
   568    674   # Note that the vcvars*.bat family of batch files typically
   569    675   # set this for you.  Otherwise, the linker will attempt
   570    676   # to deduce the binary type based on the object files.
   571    677   !IFDEF PLATFORM
   572         -LTLINKOPTS = /MACHINE:$(PLATFORM)
   573         -LTLIBOPTS = /MACHINE:$(PLATFORM)
          678  +LTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM)
          679  +LTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM)
          680  +!ELSE
          681  +LTLINKOPTS = /NOLOGO
          682  +LTLIBOPTS = /NOLOGO
   574    683   !ENDIF
   575    684   
   576    685   # When compiling for use in the WinRT environment, the following
   577    686   # linker option must be used to mark the executable as runnable
   578    687   # only in the context of an application container.
   579    688   #
   580    689   !IF $(FOR_WINRT)!=0
................................................................................
   692    801   LIBRESOBJS = sqlite3res.lo
   693    802   !ELSE
   694    803   LIBRESOBJS =
   695    804   !ENDIF
   696    805   
   697    806   # All of the source code files.
   698    807   #
   699         -SRC = \
          808  +SRC1 = \
   700    809     $(TOP)\src\alter.c \
   701    810     $(TOP)\src\analyze.c \
   702    811     $(TOP)\src\attach.c \
   703    812     $(TOP)\src\auth.c \
   704    813     $(TOP)\src\backup.c \
   705    814     $(TOP)\src\bitvec.c \
   706    815     $(TOP)\src\btmutex.c \
................................................................................
   742    851     $(TOP)\src\notify.c \
   743    852     $(TOP)\src\os.c \
   744    853     $(TOP)\src\os.h \
   745    854     $(TOP)\src\os_common.h \
   746    855     $(TOP)\src\os_setup.h \
   747    856     $(TOP)\src\os_unix.c \
   748    857     $(TOP)\src\os_win.c \
   749         -  $(TOP)\src\os_win.h \
          858  +  $(TOP)\src\os_win.h
          859  +SRC2 = \
   750    860     $(TOP)\src\pager.c \
   751    861     $(TOP)\src\pager.h \
   752    862     $(TOP)\src\parse.y \
   753    863     $(TOP)\src\pcache.c \
   754    864     $(TOP)\src\pcache.h \
   755    865     $(TOP)\src\pcache1.c \
   756    866     $(TOP)\src\pragma.c \
................................................................................
   789    899     $(TOP)\src\wal.h \
   790    900     $(TOP)\src\walker.c \
   791    901     $(TOP)\src\where.c \
   792    902     $(TOP)\src\whereInt.h
   793    903   
   794    904   # Source code for extensions
   795    905   #
   796         -SRC = $(SRC) \
          906  +SRC3 = \
   797    907     $(TOP)\ext\fts1\fts1.c \
   798    908     $(TOP)\ext\fts1\fts1.h \
   799    909     $(TOP)\ext\fts1\fts1_hash.c \
   800    910     $(TOP)\ext\fts1\fts1_hash.h \
   801    911     $(TOP)\ext\fts1\fts1_porter.c \
   802    912     $(TOP)\ext\fts1\fts1_tokenizer.h \
   803         -  $(TOP)\ext\fts1\fts1_tokenizer1.c
   804         -SRC = $(SRC) \
          913  +  $(TOP)\ext\fts1\fts1_tokenizer1.c \
   805    914     $(TOP)\ext\fts2\fts2.c \
   806    915     $(TOP)\ext\fts2\fts2.h \
   807    916     $(TOP)\ext\fts2\fts2_hash.c \
   808    917     $(TOP)\ext\fts2\fts2_hash.h \
   809    918     $(TOP)\ext\fts2\fts2_icu.c \
   810    919     $(TOP)\ext\fts2\fts2_porter.c \
   811    920     $(TOP)\ext\fts2\fts2_tokenizer.h \
   812    921     $(TOP)\ext\fts2\fts2_tokenizer.c \
   813    922     $(TOP)\ext\fts2\fts2_tokenizer1.c
   814         -SRC = $(SRC) \
          923  +SRC4 = \
   815    924     $(TOP)\ext\fts3\fts3.c \
   816    925     $(TOP)\ext\fts3\fts3.h \
   817    926     $(TOP)\ext\fts3\fts3Int.h \
   818    927     $(TOP)\ext\fts3\fts3_aux.c \
   819    928     $(TOP)\ext\fts3\fts3_expr.c \
   820    929     $(TOP)\ext\fts3\fts3_hash.c \
   821    930     $(TOP)\ext\fts3\fts3_hash.h \
................................................................................
   824    933     $(TOP)\ext\fts3\fts3_snippet.c \
   825    934     $(TOP)\ext\fts3\fts3_tokenizer.h \
   826    935     $(TOP)\ext\fts3\fts3_tokenizer.c \
   827    936     $(TOP)\ext\fts3\fts3_tokenizer1.c \
   828    937     $(TOP)\ext\fts3\fts3_tokenize_vtab.c \
   829    938     $(TOP)\ext\fts3\fts3_unicode.c \
   830    939     $(TOP)\ext\fts3\fts3_unicode2.c \
   831         -  $(TOP)\ext\fts3\fts3_write.c
   832         -SRC = $(SRC) \
          940  +  $(TOP)\ext\fts3\fts3_write.c \
   833    941     $(TOP)\ext\icu\sqliteicu.h \
   834         -  $(TOP)\ext\icu\icu.c
   835         -SRC = $(SRC) \
          942  +  $(TOP)\ext\icu\icu.c \
   836    943     $(TOP)\ext\rtree\rtree.h \
   837    944     $(TOP)\ext\rtree\rtree.c
   838    945   
   839    946   
   840    947   # Generated source code files
   841    948   #
   842         -SRC = $(SRC) \
          949  +SRC5 = \
   843    950     keywordhash.h \
   844    951     opcodes.c \
   845    952     opcodes.h \
   846    953     parse.c \
   847    954     parse.h \
   848    955     sqlite3.h
   849    956   
          957  +# All source code files.
          958  +#
          959  +SRC = $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5)
          960  +
   850    961   # Source code to the test files.
   851    962   #
   852    963   TESTSRC = \
   853    964     $(TOP)\src\test1.c \
   854    965     $(TOP)\src\test2.c \
   855    966     $(TOP)\src\test3.c \
   856    967     $(TOP)\src\test4.c \
................................................................................
  1013   1124   
  1014   1125   libsqlite3.lib:	$(LIBOBJ)
  1015   1126   	$(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS)
  1016   1127   
  1017   1128   libtclsqlite3.lib:	tclsqlite.lo libsqlite3.lib
  1018   1129   	$(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCL:tcl=tclstub) $(TLIBS)
  1019   1130   
  1020         -sqlite3.exe:	$(TOP)\src\shell.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h
  1021         -	$(LTLINK) $(READLINE_FLAGS) $(TOP)\src\shell.c \
  1022         -		/link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
         1131  +sqlite3.exe:	$(TOP)\src\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h
         1132  +	$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\src\shell.c \
         1133  +		/link /pdb:sqlite3sh.pdb $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
  1023   1134   
  1024         -mptester.exe:	$(TOP)\mptest\mptest.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h
  1025         -	$(LTLINK) $(TOP)\mptest\mptest.c \
  1026         -		/link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
         1135  +mptester.exe:	$(TOP)\mptest\mptest.c $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h
         1136  +	$(LTLINK) $(SHELL_COMPILE_OPTS) $(TOP)\mptest\mptest.c \
         1137  +		/link $(LTLINKOPTS) $(LTLIBPATHS) $(SHELL_LINK_OPTS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
  1027   1138   
  1028   1139   # This target creates a directory named "tsrc" and fills it with
  1029   1140   # copies of all of the C source code and header files needed to
  1030   1141   # build on the target system.  Some of the C source code and header
  1031   1142   # files are automatically generated.  This target takes care of
  1032   1143   # all that automatic generation.
  1033   1144   #
  1034   1145   .target_source:	$(SRC) $(TOP)\tool\vdbe-compress.tcl
  1035         -	-rmdir /S/Q tsrc
         1146  +	-rmdir /Q/S tsrc 2>NUL
  1036   1147   	-mkdir tsrc
  1037         -	for %i in ($(SRC)) do copy /Y %i tsrc
  1038         -	del /Q tsrc\sqlite.h.in tsrc\parse.y
         1148  +	for %i in ($(SRC1)) do copy /Y %i tsrc
         1149  +	for %i in ($(SRC2)) do copy /Y %i tsrc
         1150  +	for %i in ($(SRC3)) do copy /Y %i tsrc
         1151  +	for %i in ($(SRC4)) do copy /Y %i tsrc
         1152  +	for %i in ($(SRC5)) do copy /Y %i tsrc
         1153  +	del /Q tsrc\sqlite.h.in tsrc\parse.y 2>NUL
  1039   1154   	$(TCLSH_CMD) $(TOP)\tool\vdbe-compress.tcl $(OPTS) < tsrc\vdbe.c > vdbe.new
  1040   1155   	move vdbe.new tsrc\vdbe.c
  1041   1156   	echo > .target_source
  1042   1157   
  1043   1158   sqlite3.c:	.target_source $(TOP)\tool\mksqlite3c.tcl
  1044   1159   	$(TCLSH_CMD) $(TOP)\tool\mksqlite3c.tcl $(MKSQLITE3C_ARGS)
  1045   1160   	copy tsrc\shell.c .
................................................................................
  1056   1171   !ELSE
  1057   1172   SQLITE3C = sqlite3.c
  1058   1173   !ENDIF
  1059   1174   
  1060   1175   # Rule to build the amalgamation
  1061   1176   #
  1062   1177   sqlite3.lo:	$(SQLITE3C)
  1063         -	$(LTCOMPILE) -c $(SQLITE3C)
         1178  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(SQLITE3C)
  1064   1179   
  1065   1180   # Rules to build the LEMON compiler generator
  1066   1181   #
  1067   1182   lempar.c:	$(TOP)\src\lempar.c
  1068   1183   	copy $(TOP)\src\lempar.c .
  1069   1184   
  1070   1185   lemon.exe:	$(TOP)\tool\lemon.c lempar.c
................................................................................
  1074   1189   # Rules to build individual *.lo files from generated *.c files. This
  1075   1190   # applies to:
  1076   1191   #
  1077   1192   #     parse.lo
  1078   1193   #     opcodes.lo
  1079   1194   #
  1080   1195   parse.lo:	parse.c $(HDR)
  1081         -	$(LTCOMPILE) -c parse.c
         1196  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c parse.c
  1082   1197   
  1083   1198   opcodes.lo:	opcodes.c
  1084         -	$(LTCOMPILE) -c opcodes.c
         1199  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c opcodes.c
  1085   1200   
  1086   1201   # Rule to build the Win32 resources object file.
  1087   1202   #
  1088   1203   !IF $(USE_RC)!=0
  1089   1204   $(LIBRESOBJS):	$(TOP)\src\sqlite3.rc $(HDR)
  1090   1205   	echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h
  1091   1206   	for /F %%V in ('type "$(TOP)\VERSION"') do ( \
................................................................................
  1095   1210   	echo #endif >> sqlite3rc.h
  1096   1211   	$(LTRCOMPILE) -fo $(LIBRESOBJS) $(TOP)\src\sqlite3.rc
  1097   1212   !ENDIF
  1098   1213   
  1099   1214   # Rules to build individual *.lo files from files in the src directory.
  1100   1215   #
  1101   1216   alter.lo:	$(TOP)\src\alter.c $(HDR)
  1102         -	$(LTCOMPILE) -c $(TOP)\src\alter.c
         1217  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\alter.c
  1103   1218   
  1104   1219   analyze.lo:	$(TOP)\src\analyze.c $(HDR)
  1105         -	$(LTCOMPILE) -c $(TOP)\src\analyze.c
         1220  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\analyze.c
  1106   1221   
  1107   1222   attach.lo:	$(TOP)\src\attach.c $(HDR)
  1108         -	$(LTCOMPILE) -c $(TOP)\src\attach.c
         1223  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\attach.c
  1109   1224   
  1110   1225   auth.lo:	$(TOP)\src\auth.c $(HDR)
  1111         -	$(LTCOMPILE) -c $(TOP)\src\auth.c
         1226  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\auth.c
  1112   1227   
  1113   1228   backup.lo:	$(TOP)\src\backup.c $(HDR)
  1114         -	$(LTCOMPILE) -c $(TOP)\src\backup.c
         1229  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\backup.c
  1115   1230   
  1116   1231   bitvec.lo:	$(TOP)\src\bitvec.c $(HDR)
  1117         -	$(LTCOMPILE) -c $(TOP)\src\bitvec.c
         1232  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\bitvec.c
  1118   1233   
  1119   1234   btmutex.lo:	$(TOP)\src\btmutex.c $(HDR)
  1120         -	$(LTCOMPILE) -c $(TOP)\src\btmutex.c
         1235  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\btmutex.c
  1121   1236   
  1122   1237   btree.lo:	$(TOP)\src\btree.c $(HDR) $(TOP)\src\pager.h
  1123         -	$(LTCOMPILE) -c $(TOP)\src\btree.c
         1238  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\btree.c
  1124   1239   
  1125   1240   build.lo:	$(TOP)\src\build.c $(HDR)
  1126         -	$(LTCOMPILE) -c $(TOP)\src\build.c
         1241  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\build.c
  1127   1242   
  1128   1243   callback.lo:	$(TOP)\src\callback.c $(HDR)
  1129         -	$(LTCOMPILE) -c $(TOP)\src\callback.c
         1244  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\callback.c
  1130   1245   
  1131   1246   complete.lo:	$(TOP)\src\complete.c $(HDR)
  1132         -	$(LTCOMPILE) -c $(TOP)\src\complete.c
         1247  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\complete.c
  1133   1248   
  1134   1249   ctime.lo:	$(TOP)\src\ctime.c $(HDR)
  1135         -	$(LTCOMPILE) -c $(TOP)\src\ctime.c
         1250  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\ctime.c
  1136   1251   
  1137   1252   date.lo:	$(TOP)\src\date.c $(HDR)
  1138         -	$(LTCOMPILE) -c $(TOP)\src\date.c
         1253  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\date.c
  1139   1254   
  1140   1255   delete.lo:	$(TOP)\src\delete.c $(HDR)
  1141         -	$(LTCOMPILE) -c $(TOP)\src\delete.c
         1256  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\delete.c
  1142   1257   
  1143   1258   expr.lo:	$(TOP)\src\expr.c $(HDR)
  1144         -	$(LTCOMPILE) -c $(TOP)\src\expr.c
         1259  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\expr.c
  1145   1260   
  1146   1261   fault.lo:	$(TOP)\src\fault.c $(HDR)
  1147         -	$(LTCOMPILE) -c $(TOP)\src\fault.c
         1262  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\fault.c
  1148   1263   
  1149   1264   fkey.lo:	$(TOP)\src\fkey.c $(HDR)
  1150         -	$(LTCOMPILE) -c $(TOP)\src\fkey.c
         1265  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\fkey.c
  1151   1266   
  1152   1267   func.lo:	$(TOP)\src\func.c $(HDR)
  1153         -	$(LTCOMPILE) -c $(TOP)\src\func.c
         1268  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\func.c
  1154   1269   
  1155   1270   global.lo:	$(TOP)\src\global.c $(HDR)
  1156         -	$(LTCOMPILE) -c $(TOP)\src\global.c
         1271  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\global.c
  1157   1272   
  1158   1273   hash.lo:	$(TOP)\src\hash.c $(HDR)
  1159         -	$(LTCOMPILE) -c $(TOP)\src\hash.c
         1274  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\hash.c
  1160   1275   
  1161   1276   insert.lo:	$(TOP)\src\insert.c $(HDR)
  1162         -	$(LTCOMPILE) -c $(TOP)\src\insert.c
         1277  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\insert.c
  1163   1278   
  1164   1279   journal.lo:	$(TOP)\src\journal.c $(HDR)
  1165         -	$(LTCOMPILE) -c $(TOP)\src\journal.c
         1280  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\journal.c
  1166   1281   
  1167   1282   legacy.lo:	$(TOP)\src\legacy.c $(HDR)
  1168         -	$(LTCOMPILE) -c $(TOP)\src\legacy.c
         1283  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\legacy.c
  1169   1284   
  1170   1285   loadext.lo:	$(TOP)\src\loadext.c $(HDR)
  1171         -	$(LTCOMPILE) -c $(TOP)\src\loadext.c
         1286  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\loadext.c
  1172   1287   
  1173   1288   main.lo:	$(TOP)\src\main.c $(HDR)
  1174         -	$(LTCOMPILE) -c $(TOP)\src\main.c
         1289  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\main.c
  1175   1290   
  1176   1291   malloc.lo:	$(TOP)\src\malloc.c $(HDR)
  1177         -	$(LTCOMPILE) -c $(TOP)\src\malloc.c
         1292  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\malloc.c
  1178   1293   
  1179   1294   mem0.lo:	$(TOP)\src\mem0.c $(HDR)
  1180         -	$(LTCOMPILE) -c $(TOP)\src\mem0.c
         1295  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem0.c
  1181   1296   
  1182   1297   mem1.lo:	$(TOP)\src\mem1.c $(HDR)
  1183         -	$(LTCOMPILE) -c $(TOP)\src\mem1.c
         1298  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem1.c
  1184   1299   
  1185   1300   mem2.lo:	$(TOP)\src\mem2.c $(HDR)
  1186         -	$(LTCOMPILE) -c $(TOP)\src\mem2.c
         1301  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem2.c
  1187   1302   
  1188   1303   mem3.lo:	$(TOP)\src\mem3.c $(HDR)
  1189         -	$(LTCOMPILE) -c $(TOP)\src\mem3.c
         1304  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem3.c
  1190   1305   
  1191   1306   mem5.lo:	$(TOP)\src\mem5.c $(HDR)
  1192         -	$(LTCOMPILE) -c $(TOP)\src\mem5.c
         1307  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem5.c
  1193   1308   
  1194   1309   memjournal.lo:	$(TOP)\src\memjournal.c $(HDR)
  1195         -	$(LTCOMPILE) -c $(TOP)\src\memjournal.c
         1310  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\memjournal.c
  1196   1311   
  1197   1312   mutex.lo:	$(TOP)\src\mutex.c $(HDR)
  1198         -	$(LTCOMPILE) -c $(TOP)\src\mutex.c
         1313  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex.c
  1199   1314   
  1200   1315   mutex_noop.lo:	$(TOP)\src\mutex_noop.c $(HDR)
  1201         -	$(LTCOMPILE) -c $(TOP)\src\mutex_noop.c
         1316  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex_noop.c
  1202   1317   
  1203   1318   mutex_unix.lo:	$(TOP)\src\mutex_unix.c $(HDR)
  1204         -	$(LTCOMPILE) -c $(TOP)\src\mutex_unix.c
         1319  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex_unix.c
  1205   1320   
  1206   1321   mutex_w32.lo:	$(TOP)\src\mutex_w32.c $(HDR)
  1207         -	$(LTCOMPILE) -c $(TOP)\src\mutex_w32.c
         1322  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex_w32.c
  1208   1323   
  1209   1324   notify.lo:	$(TOP)\src\notify.c $(HDR)
  1210         -	$(LTCOMPILE) -c $(TOP)\src\notify.c
         1325  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\notify.c
  1211   1326   
  1212   1327   pager.lo:	$(TOP)\src\pager.c $(HDR) $(TOP)\src\pager.h
  1213         -	$(LTCOMPILE) -c $(TOP)\src\pager.c
         1328  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pager.c
  1214   1329   
  1215   1330   pcache.lo:	$(TOP)\src\pcache.c $(HDR) $(TOP)\src\pcache.h
  1216         -	$(LTCOMPILE) -c $(TOP)\src\pcache.c
         1331  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pcache.c
  1217   1332   
  1218   1333   pcache1.lo:	$(TOP)\src\pcache1.c $(HDR) $(TOP)\src\pcache.h
  1219         -	$(LTCOMPILE) -c $(TOP)\src\pcache1.c
         1334  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pcache1.c
  1220   1335   
  1221   1336   os.lo:	$(TOP)\src\os.c $(HDR)
  1222         -	$(LTCOMPILE) -c $(TOP)\src\os.c
         1337  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\os.c
  1223   1338   
  1224   1339   os_unix.lo:	$(TOP)\src\os_unix.c $(HDR)
  1225         -	$(LTCOMPILE) -c $(TOP)\src\os_unix.c
         1340  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\os_unix.c
  1226   1341   
  1227   1342   os_win.lo:	$(TOP)\src\os_win.c $(HDR)
  1228         -	$(LTCOMPILE) -c $(TOP)\src\os_win.c
         1343  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\os_win.c
  1229   1344   
  1230   1345   pragma.lo:	$(TOP)\src\pragma.c $(HDR)
  1231         -	$(LTCOMPILE) -c $(TOP)\src\pragma.c
         1346  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pragma.c
  1232   1347   
  1233   1348   prepare.lo:	$(TOP)\src\prepare.c $(HDR)
  1234         -	$(LTCOMPILE) -c $(TOP)\src\prepare.c
         1349  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\prepare.c
  1235   1350   
  1236   1351   printf.lo:	$(TOP)\src\printf.c $(HDR)
  1237         -	$(LTCOMPILE) -c $(TOP)\src\printf.c
         1352  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\printf.c
  1238   1353   
  1239   1354   random.lo:	$(TOP)\src\random.c $(HDR)
  1240         -	$(LTCOMPILE) -c $(TOP)\src\random.c
         1355  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\random.c
  1241   1356   
  1242   1357   resolve.lo:	$(TOP)\src\resolve.c $(HDR)
  1243         -	$(LTCOMPILE) -c $(TOP)\src\resolve.c
         1358  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\resolve.c
  1244   1359   
  1245   1360   rowset.lo:	$(TOP)\src\rowset.c $(HDR)
  1246         -	$(LTCOMPILE) -c $(TOP)\src\rowset.c
         1361  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\rowset.c
  1247   1362   
  1248   1363   select.lo:	$(TOP)\src\select.c $(HDR)
  1249         -	$(LTCOMPILE) -c $(TOP)\src\select.c
         1364  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\select.c
  1250   1365   
  1251   1366   status.lo:	$(TOP)\src\status.c $(HDR)
  1252         -	$(LTCOMPILE) -c $(TOP)\src\status.c
         1367  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\status.c
  1253   1368   
  1254   1369   table.lo:	$(TOP)\src\table.c $(HDR)
  1255         -	$(LTCOMPILE) -c $(TOP)\src\table.c
         1370  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\table.c
  1256   1371   
  1257   1372   threads.lo:	$(TOP)\src\threads.c $(HDR)
  1258         -	$(LTCOMPILE) -c $(TOP)\src\threads.c
         1373  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\threads.c
  1259   1374   
  1260   1375   tokenize.lo:	$(TOP)\src\tokenize.c keywordhash.h $(HDR)
  1261         -	$(LTCOMPILE) -c $(TOP)\src\tokenize.c
         1376  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\tokenize.c
  1262   1377   
  1263   1378   trigger.lo:	$(TOP)\src\trigger.c $(HDR)
  1264         -	$(LTCOMPILE) -c $(TOP)\src\trigger.c
         1379  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\trigger.c
  1265   1380   
  1266   1381   update.lo:	$(TOP)\src\update.c $(HDR)
  1267         -	$(LTCOMPILE) -c $(TOP)\src\update.c
         1382  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\update.c
  1268   1383   
  1269   1384   utf.lo:	$(TOP)\src\utf.c $(HDR)
  1270         -	$(LTCOMPILE) -c $(TOP)\src\utf.c
         1385  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\utf.c
  1271   1386   
  1272   1387   util.lo:	$(TOP)\src\util.c $(HDR)
  1273         -	$(LTCOMPILE) -c $(TOP)\src\util.c
         1388  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\util.c
  1274   1389   
  1275   1390   vacuum.lo:	$(TOP)\src\vacuum.c $(HDR)
  1276         -	$(LTCOMPILE) -c $(TOP)\src\vacuum.c
         1391  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vacuum.c
  1277   1392   
  1278   1393   vdbe.lo:	$(TOP)\src\vdbe.c $(HDR)
  1279         -	$(LTCOMPILE) -c $(TOP)\src\vdbe.c
         1394  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbe.c
  1280   1395   
  1281   1396   vdbeapi.lo:	$(TOP)\src\vdbeapi.c $(HDR)
  1282         -	$(LTCOMPILE) -c $(TOP)\src\vdbeapi.c
         1397  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbeapi.c
  1283   1398   
  1284   1399   vdbeaux.lo:	$(TOP)\src\vdbeaux.c $(HDR)
  1285         -	$(LTCOMPILE) -c $(TOP)\src\vdbeaux.c
         1400  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbeaux.c
  1286   1401   
  1287   1402   vdbeblob.lo:	$(TOP)\src\vdbeblob.c $(HDR)
  1288         -	$(LTCOMPILE) -c $(TOP)\src\vdbeblob.c
         1403  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbeblob.c
  1289   1404   
  1290   1405   vdbemem.lo:	$(TOP)\src\vdbemem.c $(HDR)
  1291         -	$(LTCOMPILE) -c $(TOP)\src\vdbemem.c
         1406  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbemem.c
  1292   1407   
  1293   1408   vdbesort.lo:	$(TOP)\src\vdbesort.c $(HDR)
  1294         -	$(LTCOMPILE) -c $(TOP)\src\vdbesort.c
         1409  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbesort.c
  1295   1410   
  1296   1411   vdbetrace.lo:	$(TOP)\src\vdbetrace.c $(HDR)
  1297         -	$(LTCOMPILE) -c $(TOP)\src\vdbetrace.c
         1412  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbetrace.c
  1298   1413   
  1299   1414   vtab.lo:	$(TOP)\src\vtab.c $(HDR)
  1300         -	$(LTCOMPILE) -c $(TOP)\src\vtab.c
         1415  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vtab.c
  1301   1416   
  1302   1417   wal.lo:	$(TOP)\src\wal.c $(HDR)
  1303         -	$(LTCOMPILE) -c $(TOP)\src\wal.c
         1418  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\wal.c
  1304   1419   
  1305   1420   walker.lo:	$(TOP)\src\walker.c $(HDR)
  1306         -	$(LTCOMPILE) -c $(TOP)\src\walker.c
         1421  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\walker.c
  1307   1422   
  1308   1423   where.lo:	$(TOP)\src\where.c $(HDR)
  1309         -	$(LTCOMPILE) -c $(TOP)\src\where.c
         1424  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\where.c
  1310   1425   
  1311   1426   tclsqlite.lo:	$(TOP)\src\tclsqlite.c $(HDR)
  1312         -	$(LTCOMPILE) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
         1427  +	$(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
  1313   1428   
  1314   1429   tclsqlite-shell.lo:	$(TOP)\src\tclsqlite.c $(HDR)
  1315         -	$(LTCOMPILE) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
         1430  +	$(LTCOMPILE) $(NO_WARN) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
  1316   1431   
  1317         -tclsqlite3.exe:	tclsqlite-shell.lo libsqlite3.lib $(LIBRESOBJS)
  1318         -	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /OUT:$@ libsqlite3.lib tclsqlite-shell.lo $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
         1432  +tclsqlite3.exe:	tclsqlite-shell.lo $(SQLITE3C) $(LIBRESOBJS)
         1433  +	$(LTLINK) $(SQLITE3C) /link $(LTLINKOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite-shell.lo $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
  1319   1434   
  1320   1435   # Rules to build opcodes.c and opcodes.h
  1321   1436   #
  1322   1437   opcodes.c:	opcodes.h $(TOP)\mkopcodec.awk
  1323   1438   	$(NAWK) -f $(TOP)\mkopcodec.awk opcodes.h > opcodes.c
  1324   1439   
  1325   1440   opcodes.h:	parse.h $(TOP)\src\vdbe.c $(TOP)\mkopcodeh.awk
................................................................................
  1326   1441   	type parse.h $(TOP)\src\vdbe.c | $(NAWK) -f $(TOP)\mkopcodeh.awk > opcodes.h
  1327   1442   
  1328   1443   # Rules to build parse.c and parse.h - the outputs of lemon.
  1329   1444   #
  1330   1445   parse.h:	parse.c
  1331   1446   
  1332   1447   parse.c:	$(TOP)\src\parse.y lemon.exe $(TOP)\addopcodes.awk
  1333         -	del /Q parse.y parse.h parse.h.temp
         1448  +	del /Q parse.y parse.h parse.h.temp 2>NUL
  1334   1449   	copy $(TOP)\src\parse.y .
  1335   1450   	.\lemon.exe $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(OPTS) parse.y
  1336   1451   	move parse.h parse.h.temp
  1337   1452   	$(NAWK) -f $(TOP)\addopcodes.awk parse.h.temp > parse.h
  1338   1453   
  1339   1454   sqlite3.h:	$(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION
  1340   1455   	$(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > sqlite3.h
................................................................................
  1347   1462   	.\mkkeywordhash.exe > keywordhash.h
  1348   1463   
  1349   1464   
  1350   1465   
  1351   1466   # Rules to build the extension objects.
  1352   1467   #
  1353   1468   icu.lo:	$(TOP)\ext\icu\icu.c $(HDR) $(EXTHDR)
  1354         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\icu\icu.c
         1469  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\icu\icu.c
  1355   1470   
  1356   1471   fts2.lo:	$(TOP)\ext\fts2\fts2.c $(HDR) $(EXTHDR)
  1357         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2.c
         1472  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2.c
  1358   1473   
  1359   1474   fts2_hash.lo:	$(TOP)\ext\fts2\fts2_hash.c $(HDR) $(EXTHDR)
  1360         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_hash.c
         1475  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_hash.c
  1361   1476   
  1362   1477   fts2_icu.lo:	$(TOP)\ext\fts2\fts2_icu.c $(HDR) $(EXTHDR)
  1363         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_icu.c
         1478  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_icu.c
  1364   1479   
  1365   1480   fts2_porter.lo:	$(TOP)\ext\fts2\fts2_porter.c $(HDR) $(EXTHDR)
  1366         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_porter.c
         1481  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_porter.c
  1367   1482   
  1368   1483   fts2_tokenizer.lo:	$(TOP)\ext\fts2\fts2_tokenizer.c $(HDR) $(EXTHDR)
  1369         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer.c
         1484  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer.c
  1370   1485   
  1371   1486   fts2_tokenizer1.lo:	$(TOP)\ext\fts2\fts2_tokenizer1.c $(HDR) $(EXTHDR)
  1372         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer1.c
         1487  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer1.c
  1373   1488   
  1374   1489   fts3.lo:	$(TOP)\ext\fts3\fts3.c $(HDR) $(EXTHDR)
  1375         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3.c
         1490  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3.c
  1376   1491   
  1377   1492   fts3_aux.lo:	$(TOP)\ext\fts3\fts3_aux.c $(HDR) $(EXTHDR)
  1378         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_aux.c
         1493  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_aux.c
  1379   1494   
  1380   1495   fts3_expr.lo:	$(TOP)\ext\fts3\fts3_expr.c $(HDR) $(EXTHDR)
  1381         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_expr.c
         1496  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_expr.c
  1382   1497   
  1383   1498   fts3_hash.lo:	$(TOP)\ext\fts3\fts3_hash.c $(HDR) $(EXTHDR)
  1384         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_hash.c
         1499  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_hash.c
  1385   1500   
  1386   1501   fts3_icu.lo:	$(TOP)\ext\fts3\fts3_icu.c $(HDR) $(EXTHDR)
  1387         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_icu.c
         1502  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_icu.c
  1388   1503   
  1389   1504   fts3_snippet.lo:	$(TOP)\ext\fts3\fts3_snippet.c $(HDR) $(EXTHDR)
  1390         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_snippet.c
         1505  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_snippet.c
  1391   1506   
  1392   1507   fts3_porter.lo:	$(TOP)\ext\fts3\fts3_porter.c $(HDR) $(EXTHDR)
  1393         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_porter.c
         1508  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_porter.c
  1394   1509   
  1395   1510   fts3_tokenizer.lo:	$(TOP)\ext\fts3\fts3_tokenizer.c $(HDR) $(EXTHDR)
  1396         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer.c
         1511  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer.c
  1397   1512   
  1398   1513   fts3_tokenizer1.lo:	$(TOP)\ext\fts3\fts3_tokenizer1.c $(HDR) $(EXTHDR)
  1399         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer1.c
         1514  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer1.c
  1400   1515   
  1401   1516   fts3_tokenize_vtab.lo:	$(TOP)\ext\fts3\fts3_tokenize_vtab.c $(HDR) $(EXTHDR)
  1402         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenize_vtab.c
         1517  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenize_vtab.c
  1403   1518   
  1404   1519   fts3_unicode.lo:	$(TOP)\ext\fts3\fts3_unicode.c $(HDR) $(EXTHDR)
  1405         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode.c
         1520  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode.c
  1406   1521   
  1407   1522   fts3_unicode2.lo:	$(TOP)\ext\fts3\fts3_unicode2.c $(HDR) $(EXTHDR)
  1408         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode2.c
         1523  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode2.c
  1409   1524   
  1410   1525   fts3_write.lo:	$(TOP)\ext\fts3\fts3_write.c $(HDR) $(EXTHDR)
  1411         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_write.c
         1526  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_write.c
  1412   1527   
  1413   1528   rtree.lo:	$(TOP)\ext\rtree\rtree.c $(HDR) $(EXTHDR)
  1414         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\rtree\rtree.c
         1529  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\rtree\rtree.c
  1415   1530   
  1416   1531   
  1417   1532   # Rules to build the 'testfixture' application.
  1418   1533   #
  1419   1534   # If using the amalgamation, use sqlite3.c directly to build the test
  1420   1535   # fixture.  Otherwise link against libsqlite3.lib.  (This distinction is
  1421   1536   # necessary because the test fixture requires non-API symbols which are
  1422   1537   # hidden when the library is built via the amalgamation).
  1423   1538   #
  1424   1539   TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
  1425   1540   TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE=""
  1426   1541   TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN)
  1427   1542   
  1428         -TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) libsqlite3.lib
         1543  +TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) $(SHELL_CORE_DEP)
  1429   1544   TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C)
  1430   1545   !IF $(USE_AMALGAMATION)==0
  1431   1546   TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0)
  1432   1547   !ELSE
  1433   1548   TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1)
  1434   1549   !ENDIF
  1435   1550   
................................................................................
  1461   1576   	copy $(SQLITE3C) + $(TOP)\src\test_stat.c + $(TOP)\src\tclsqlite.c $@
  1462   1577   	echo static const char *tclsh_main_loop(void){ >> $@
  1463   1578   	echo static const char *zMainloop = >> $@
  1464   1579   	$(NAWK) -f $(TOP)\tool\tostr.awk $(TOP)\tool\spaceanal.tcl >> $@
  1465   1580   	echo ; return zMainloop; } >> $@
  1466   1581   
  1467   1582   sqlite3_analyzer.exe:	sqlite3_analyzer.c $(LIBRESOBJS)
  1468         -	$(LTLINK) -DBUILD_sqlite -DTCLSH=2 -I$(TCLINCDIR) sqlite3_analyzer.c \
         1583  +	$(LTLINK) $(NO_WARN) -DBUILD_sqlite -DTCLSH=2 -I$(TCLINCDIR) sqlite3_analyzer.c \
  1469   1584   		/link $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
  1470   1585   
  1471   1586   testloadext.lo:	$(TOP)\src\test_loadext.c
  1472         -	$(LTCOMPILE) -c $(TOP)\src\test_loadext.c
         1587  +	$(LTCOMPILE) $(NO_WARN) -c $(TOP)\src\test_loadext.c
  1473   1588   
  1474   1589   testloadext.dll: testloadext.lo
  1475   1590   	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ testloadext.lo
  1476   1591   
  1477   1592   showdb.exe:	$(TOP)\tool\showdb.c $(SQLITE3C)
  1478         -	$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1593  +	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1479   1594   		$(TOP)\tool\showdb.c $(SQLITE3C)
  1480   1595   
  1481   1596   showstat4.exe:	$(TOP)\tool\showstat4.c $(SQLITE3C)
  1482         -	$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1597  +	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1483   1598   		$(TOP)\tool\showstat4.c $(SQLITE3C)
  1484   1599   
  1485   1600   showjournal.exe:	$(TOP)\tool\showjournal.c $(SQLITE3C)
  1486         -	$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1601  +	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1487   1602   		$(TOP)\tool\showjournal.c $(SQLITE3C)
  1488   1603   
  1489   1604   showwal.exe:	$(TOP)\tool\showwal.c $(SQLITE3C)
  1490         -	$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1605  +	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1491   1606   		$(TOP)\tool\showwal.c $(SQLITE3C)
  1492   1607   
  1493   1608   fts3view.exe:	$(TOP)\ext\fts3\tool\fts3view.c $(SQLITE3C)
  1494         -	$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1609  +	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1495   1610   		$(TOP)\ext\fts3\tool\fts3view.c $(SQLITE3C)
  1496   1611   
  1497   1612   rollback-test.exe:	$(TOP)\tool\rollback-test.c $(SQLITE3C)
  1498         -	$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1613  +	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1499   1614   		$(TOP)\tool\rollback-test.c $(SQLITE3C)
  1500   1615   
  1501   1616   LogEst.exe:	$(TOP)\tool\logest.c sqlite3.h
  1502         -	$(LTLINK) -Fe$@ $(TOP)\tool\LogEst.c
         1617  +	$(LTLINK) $(NO_WARN) -Fe$@ $(TOP)\tool\LogEst.c
  1503   1618   
  1504   1619   wordcount.exe:	$(TOP)\test\wordcount.c $(SQLITE3C)
  1505         -	$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1620  +	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1506   1621   		$(TOP)\test\wordcount.c $(SQLITE3C)
  1507   1622   
  1508   1623   speedtest1.exe:	$(TOP)\test\speedtest1.c $(SQLITE3C)
  1509         -	$(LTLINK) -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1624  +	$(LTLINK) $(NO_WARN) -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1510   1625   		$(TOP)\test\speedtest1.c $(SQLITE3C)
  1511   1626   
  1512   1627   clean:
  1513         -	del /Q *.lo *.ilk *.lib *.obj *.pdb sqlite3.exe libsqlite3.lib
  1514         -	del /Q *.cod *.da *.bb *.bbg gmon.out
  1515         -	del /Q sqlite3.h opcodes.c opcodes.h
  1516         -	del /Q lemon.* lempar.c parse.*
  1517         -	del /Q mkkeywordhash.* keywordhash.h
  1518         -	del /Q notasharedlib.*
  1519         -	-rmdir /Q/S .deps
  1520         -	-rmdir /Q/S .libs
  1521         -	-rmdir /Q/S quota2a
  1522         -	-rmdir /Q/S quota2b
  1523         -	-rmdir /Q/S quota2c
  1524         -	-rmdir /Q/S tsrc
  1525         -	del /Q .target_source
  1526         -	del /Q tclsqlite3.exe tclsqlite3.exp
  1527         -	del /Q testloadext.dll testloadext.exp
  1528         -	del /Q testfixture.exe testfixture.exp test.db
  1529         -	del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe
  1530         -	del /Q showjournal.exe showstat4.exe showwal.exe speedtest1.exe
  1531         -	del /Q wordcount.exe
  1532         -	del /Q sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def
  1533         -	del /Q sqlite3.c sqlite3-*.c
  1534         -	del /Q sqlite3rc.h
  1535         -	del /Q shell.c sqlite3ext.h
  1536         -	del /Q sqlite3_analyzer.exe sqlite3_analyzer.exp sqlite3_analyzer.c
  1537         -	del /Q sqlite-*-output.vsix
  1538         -	del /Q mptester.exe
         1628  +	del /Q *.exp *.lo *.ilk *.lib *.obj *.pdb 2>NUL
         1629  +	del /Q *.cod *.da *.bb *.bbg gmon.out 2>NUL
         1630  +	del /Q sqlite3.h opcodes.c opcodes.h 2>NUL
         1631  +	del /Q lemon.* lempar.c parse.* 2>NUL
         1632  +	del /Q mkkeywordhash.* keywordhash.h 2>NUL
         1633  +	del /Q notasharedlib.* 2>NUL
         1634  +	-rmdir /Q/S .deps 2>NUL
         1635  +	-rmdir /Q/S .libs 2>NUL
         1636  +	-rmdir /Q/S quota2a 2>NUL
         1637  +	-rmdir /Q/S quota2b 2>NUL
         1638  +	-rmdir /Q/S quota2c 2>NUL
         1639  +	-rmdir /Q/S tsrc 2>NUL
         1640  +	del /Q .target_source 2>NUL
         1641  +	del /Q tclsqlite3.exe 2>NUL
         1642  +	del /Q testloadext.dll 2>NUL
         1643  +	del /Q testfixture.exe test.db 2>NUL
         1644  +	del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe 2>NUL
         1645  +	del /Q showjournal.exe showstat4.exe showwal.exe speedtest1.exe 2>NUL
         1646  +	del /Q mptester.exe wordcount.exe 2>NUL
         1647  +	del /Q sqlite3.exe sqlite3.dll sqlite3.def 2>NUL
         1648  +	del /Q sqlite3.c sqlite3-*.c 2>NUL
         1649  +	del /Q sqlite3rc.h 2>NUL
         1650  +	del /Q shell.c sqlite3ext.h 2>NUL
         1651  +	del /Q sqlite3_analyzer.exe sqlite3_analyzer.c 2>NUL
         1652  +	del /Q sqlite-*-output.vsix 2>NUL
  1539   1653   
  1540   1654   # Dynamic link library section.
  1541   1655   #
  1542   1656   dll: sqlite3.dll
  1543   1657   
  1544   1658   sqlite3.def: libsqlite3.lib
  1545   1659   	echo EXPORTS > sqlite3.def
  1546   1660   	dumpbin /all libsqlite3.lib \
  1547   1661   		| $(NAWK) "/ 1 _?sqlite3_/ { sub(/^.* _?/,\"\");print }" \
  1548   1662   		| sort >> sqlite3.def
  1549   1663   
  1550         -sqlite3.dll: $(LIBOBJ) $(LIBRESOBJS) sqlite3.def
  1551         -	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /DEF:sqlite3.def /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
         1664  +sqlite3.dll: $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
         1665  +	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)

Changes to ext/fts3/fts3_write.c.

  1621   1621   }
  1622   1622   
  1623   1623   /*
  1624   1624   ** This is a comparison function used as a qsort() callback when sorting
  1625   1625   ** an array of pending terms by term. This occurs as part of flushing
  1626   1626   ** the contents of the pending-terms hash table to the database.
  1627   1627   */
  1628         -static int fts3CompareElemByTerm(const void *lhs, const void *rhs){
         1628  +static int SQLITE_CDECL fts3CompareElemByTerm(const void *lhs, const void *rhs){
  1629   1629     char *z1 = fts3HashKey(*(Fts3HashElem **)lhs);
  1630   1630     char *z2 = fts3HashKey(*(Fts3HashElem **)rhs);
  1631   1631     int n1 = fts3HashKeysize(*(Fts3HashElem **)lhs);
  1632   1632     int n2 = fts3HashKeysize(*(Fts3HashElem **)rhs);
  1633   1633   
  1634   1634     int n = (n1<n2 ? n1 : n2);
  1635   1635     int c = memcmp(z1, z2, n);

Changes to src/shell.c.

  2102   2102   **   +  Use p->cSep as the column separator.  The default is ",".
  2103   2103   **   +  Use p->rSep as the row separator.  The default is "\n".
  2104   2104   **   +  Keep track of the line number in p->nLine.
  2105   2105   **   +  Store the character that terminates the field in p->cTerm.  Store
  2106   2106   **      EOF on end-of-file.
  2107   2107   **   +  Report syntax errors on stderr
  2108   2108   */
  2109         -static char *csv_read_one_field(ImportCtx *p){
         2109  +static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
  2110   2110     int c;
  2111   2111     int cSep = p->cColSep;
  2112   2112     int rSep = p->cRowSep;
  2113   2113     p->n = 0;
  2114   2114     c = fgetc(p->in);
  2115   2115     if( c==EOF || seenInterrupt ){
  2116   2116       p->cTerm = EOF;
................................................................................
  2176   2176   **   +  Use p->cSep as the column separator.  The default is "\x1F".
  2177   2177   **   +  Use p->rSep as the row separator.  The default is "\x1E".
  2178   2178   **   +  Keep track of the row number in p->nLine.
  2179   2179   **   +  Store the character that terminates the field in p->cTerm.  Store
  2180   2180   **      EOF on end-of-file.
  2181   2181   **   +  Report syntax errors on stderr
  2182   2182   */
  2183         -static char *ascii_read_one_field(ImportCtx *p){
         2183  +static char *SQLITE_CDECL ascii_read_one_field(ImportCtx *p){
  2184   2184     int c;
  2185   2185     int cSep = p->cColSep;
  2186   2186     int rSep = p->cRowSep;
  2187   2187     p->n = 0;
  2188   2188     c = fgetc(p->in);
  2189   2189     if( c==EOF || seenInterrupt ){
  2190   2190       p->cTerm = EOF;
................................................................................
  2755   2755       int nCol;                   /* Number of columns in the table */
  2756   2756       int nByte;                  /* Number of bytes in an SQL string */
  2757   2757       int i, j;                   /* Loop counters */
  2758   2758       int needCommit;             /* True to COMMIT or ROLLBACK at end */
  2759   2759       int nSep;                   /* Number of bytes in p->colSeparator[] */
  2760   2760       char *zSql;                 /* An SQL statement */
  2761   2761       ImportCtx sCtx;             /* Reader context */
  2762         -    char *(*xRead)(ImportCtx*); /* Procedure to read one value */
  2763         -    int (*xCloser)(FILE*);      /* Procedure to close th3 connection */
         2762  +    char *(SQLITE_CDECL *xRead)(ImportCtx*); /* Func to read one value */
         2763  +    int (SQLITE_CDECL *xCloser)(FILE*);      /* Func to close file */
  2764   2764   
  2765   2765       if( nArg!=3 ){
  2766   2766         fprintf(stderr, "Usage: .import FILE TABLE\n");
  2767   2767         goto meta_command_exit;
  2768   2768       }
  2769   2769       zFile = azArg[1];
  2770   2770       zTable = azArg[2];
................................................................................
  4174   4174       fprintf(stderr, "%s: Error: missing argument to %s\n",
  4175   4175               argv[0], argv[argc-1]);
  4176   4176       exit(1);
  4177   4177     }
  4178   4178     return argv[i];
  4179   4179   }
  4180   4180   
  4181         -int main(int argc, char **argv){
         4181  +int SQLITE_CDECL main(int argc, char **argv){
  4182   4182     char *zErrMsg = 0;
  4183   4183     ShellState data;
  4184   4184     const char *zInitFile = 0;
  4185   4185     int i;
  4186   4186     int rc = 0;
  4187   4187     int warnInmemoryDb = 0;
  4188   4188     int readStdin = 1;

Changes to src/sqlite.h.in.

    39     39   */
    40     40   #ifdef __cplusplus
    41     41   extern "C" {
    42     42   #endif
    43     43   
    44     44   
    45     45   /*
    46         -** Add the ability to override 'extern'
           46  +** Provide the ability to override linkage features of the interface.
    47     47   */
    48     48   #ifndef SQLITE_EXTERN
    49     49   # define SQLITE_EXTERN extern
    50     50   #endif
           51  +#ifndef SQLITE_API
           52  +# define SQLITE_API
           53  +#endif
           54  +#ifndef SQLITE_CDECL
           55  +# define SQLITE_CDECL
           56  +#endif
           57  +#ifndef SQLITE_STDCALL
           58  +# define SQLITE_STDCALL
           59  +#endif
    51     60   
    52     61   /*
    53     62   ** These no-op macros are used in front of interfaces to mark those
    54     63   ** interfaces as either deprecated or experimental.  New applications
    55     64   ** should not use deprecated interfaces - they are supported for backwards
    56     65   ** compatibility only.  Application writers should be aware that
    57     66   ** experimental interfaces are subject to change in point releases.

Changes to tool/build-all-msvc.bat.

    54     54   REM SET __ECHO=ECHO
    55     55   REM SET __ECHO2=ECHO
    56     56   REM SET __ECHO3=ECHO
    57     57   IF NOT DEFINED _AECHO (SET _AECHO=REM)
    58     58   IF NOT DEFINED _CECHO (SET _CECHO=REM)
    59     59   IF NOT DEFINED _VECHO (SET _VECHO=REM)
    60     60   
           61  +SET REDIRECT=^>
           62  +IF DEFINED __ECHO SET REDIRECT=^^^>
           63  +
    61     64   %_AECHO% Running %0 %*
    62     65   
    63     66   REM SET DFLAGS=/L
    64     67   
    65     68   %_VECHO% DFlags = '%DFLAGS%'
    66     69   
    67     70   SET FFLAGS=/V /F /G /H /I /R /Y /Z
................................................................................
   314    317         REM NOTE: When preparing the debug build, set the DEBUG and MEMDEBUG
   315    318         REM       environment variables to be picked up by the MSVC makefile
   316    319         REM       itself.
   317    320         REM
   318    321         %_AECHO% Building the %%B configuration for platform %%P with name %%D...
   319    322   
   320    323         IF /I "%%B" == "Debug" (
   321         -        SET DEBUG=2
          324  +        REM
          325  +        REM NOTE: Using this level for the DEBUG environment variable should
          326  +        REM       disable all compiler optimizations and prevent use of the
          327  +        REM       NDEBUG define.  Additionally, both SQLITE_ENABLE_API_ARMOR
          328  +        REM       and SQLITE_DEBUG defines should be enabled.
          329  +        REM
          330  +        SET DEBUG=3
          331  +
          332  +        REM
          333  +        REM NOTE: Setting this to non-zero should enable the SQLITE_MEMDEBUG
          334  +        REM       define.
          335  +        REM
   322    336           SET MEMDEBUG=1
   323    337         ) ELSE (
   324    338           CALL :fn_UnsetVariable DEBUG
   325    339           CALL :fn_UnsetVariable MEMDEBUG
   326    340         )
   327    341   
   328    342         REM
................................................................................
   416    430             IF ERRORLEVEL 1 (
   417    431               ECHO Failed to clean for platform %%P.
   418    432               GOTO errors
   419    433             )
   420    434           ) ELSE (
   421    435             REM
   422    436             REM NOTE: Even when the cleaning step has been disabled, we still
   423         -          REM       need to remove the build output for the files we are
          437  +          REM       need to remove the build output for all the files we are
   424    438             REM       specifically wanting to build for each platform.
   425    439             REM
   426         -          %_AECHO% Cleaning final output files only...
   427         -          %__ECHO% DEL /Q *.lo sqlite3.dll sqlite3.lib sqlite3.pdb
          440  +          %_AECHO% Cleaning final core library output files only...
          441  +          %__ECHO% DEL /Q *.lo sqlite3.dll sqlite3.lib sqlite3.pdb 2%REDIRECT% NUL
   428    442           )
   429    443   
   430    444           REM
   431    445           REM NOTE: Call NMAKE with the MSVC makefile to build the "sqlite3.dll"
   432    446           REM       binary.  The x86 compiler will be used to compile the native
   433    447           REM       command line tools needed during the build process itself.
   434    448           REM       Also, disable looking for and/or linking to the native Tcl
................................................................................
   472    486             %__ECHO% XCOPY sqlite3.pdb "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
   473    487   
   474    488             IF ERRORLEVEL 1 (
   475    489               ECHO Failed to copy "sqlite3.pdb" to "%BINARYDIRECTORY%\%%B\%%D\".
   476    490               GOTO errors
   477    491             )
   478    492           )
          493  +
          494  +        REM
          495  +        REM NOTE: If requested, also build the shell executable.
          496  +        REM
          497  +        IF DEFINED BUILD_ALL_SHELL (
          498  +          REM
          499  +          REM NOTE: If necessary, make sure any previous build output for the
          500  +          REM       shell executable is deleted.
          501  +          REM
          502  +          IF DEFINED NOCLEAN (
          503  +            REM
          504  +            REM NOTE: Even when the cleaning step has been disabled, we still
          505  +            REM       need to remove the build output for all the files we are
          506  +            REM       specifically wanting to build for each platform.
          507  +            REM
          508  +            %_AECHO% Cleaning final shell executable output files only...
          509  +            %__ECHO% DEL /Q sqlite3.exe sqlite3sh.pdb 2%REDIRECT% NUL
          510  +          )
          511  +
          512  +          REM
          513  +          REM NOTE: Call NMAKE with the MSVC makefile to build the "sqlite3.exe"
          514  +          REM       binary.  The x86 compiler will be used to compile the native
          515  +          REM       command line tools needed during the build process itself.
          516  +          REM       Also, disable looking for and/or linking to the native Tcl
          517  +          REM       runtime library.
          518  +          REM
          519  +          %__ECHO% %NMAKE_CMD% sqlite3.exe XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS%
          520  +
          521  +          IF ERRORLEVEL 1 (
          522  +            ECHO Failed to build %%B "sqlite3.exe" for platform %%P.
          523  +            GOTO errors
          524  +          )
          525  +
          526  +          REM
          527  +          REM NOTE: Copy the "sqlite3.exe" file to the appropriate directory
          528  +          REM       for the build and platform beneath the binary directory.
          529  +          REM
          530  +          %__ECHO% XCOPY sqlite3.exe "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
          531  +
          532  +          IF ERRORLEVEL 1 (
          533  +            ECHO Failed to copy "sqlite3.exe" to "%BINARYDIRECTORY%\%%B\%%D\".
          534  +            GOTO errors
          535  +          )
          536  +
          537  +          REM
          538  +          REM NOTE: Copy the "sqlite3sh.pdb" file to the appropriate directory
          539  +          REM       for the build and platform beneath the binary directory
          540  +          REM       unless we are prevented from doing so.
          541  +          REM
          542  +          IF NOT DEFINED NOSYMBOLS (
          543  +            %__ECHO% XCOPY sqlite3sh.pdb "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
          544  +
          545  +            IF ERRORLEVEL 1 (
          546  +              ECHO Failed to copy "sqlite3sh.pdb" to "%BINARYDIRECTORY%\%%B\%%D\".
          547  +              GOTO errors
          548  +            )
          549  +          )
          550  +        )
   479    551         )
   480    552       )
   481    553     )
   482    554   
   483    555     REM
   484    556     REM NOTE: Handle any errors generated during the nested command shell.
   485    557     REM

Changes to tool/mksqlite3c-noext.tcl.

    13     13   # For example, the "parse.c" and "parse.h" files to implement the
    14     14   # the parser are derived from "parse.y" using lemon.  And the 
    15     15   # "keywordhash.h" files is generated by a program named "mkkeywordhash".
    16     16   #
    17     17   # After the "tsrc" directory has been created and populated, run
    18     18   # this script:
    19     19   #
    20         -#      tclsh mksqlite3c.tcl
           20  +#      tclsh mksqlite3c-noext.tcl
    21     21   #
    22     22   # The amalgamated SQLite code will be written into sqlite3.c
    23     23   #
    24     24   
    25     25   # Begin by reading the "sqlite3.h" header file.  Extract the version number
    26         -# from in this file.  The versioon number is needed to generate the header
           26  +# from in this file.  The version number is needed to generate the header
    27     27   # comment of the amalgamation.
    28     28   #
    29     29   if {[lsearch $argv --nostatic]>=0} {
    30     30     set addstatic 0
    31     31   } else {
    32     32     set addstatic 1
    33     33   }
................................................................................
    76     76   */
    77     77   #define SQLITE_CORE 1
    78     78   #define SQLITE_AMALGAMATION 1}]
    79     79   if {$addstatic} {
    80     80     puts $out \
    81     81   {#ifndef SQLITE_PRIVATE
    82     82   # define SQLITE_PRIVATE static
    83         -#endif
    84         -#ifndef SQLITE_API
    85         -# define SQLITE_API
    86     83   #endif}
    87     84   }
    88     85   
    89     86   # These are the header files used by SQLite.  The first time any of these 
    90     87   # files are seen in a #include statement in the C code, include the complete
    91     88   # text of the file in-line.  The file only needs to be included once.
    92     89   #
................................................................................
   110    107      sqlite3.h
   111    108      sqliteicu.h
   112    109      sqliteInt.h
   113    110      sqliteLimit.h
   114    111      vdbe.h
   115    112      vdbeInt.h
   116    113      wal.h
          114  +   whereInt.h
   117    115   } {
   118    116     set available_hdr($hdr) 1
   119    117   }
   120    118   set available_hdr(sqliteInt.h) 0
          119  +
          120  +# These headers should be copied into the amalgamation without modifying any
          121  +# of their function declarations or definitions.
          122  +set varonly_hdr(sqlite3.h) 1
          123  +
          124  +# These are the functions that accept a variable number of arguments.  They
          125  +# always need to use the "cdecl" calling convention even when another calling
          126  +# convention (e.g. "stcall") is being used for the rest of the library.
          127  +set cdecllist {
          128  +  sqlite3_config
          129  +  sqlite3_db_config
          130  +  sqlite3_log
          131  +  sqlite3_mprintf
          132  +  sqlite3_snprintf
          133  +  sqlite3_test_control
          134  +  sqlite3_vtab_config
          135  +}
   121    136   
   122    137   # 78 stars used for comment formatting.
   123    138   set s78 \
   124    139   {*****************************************************************************}
   125    140   
   126    141   # Insert a comment into the code
   127    142   #
................................................................................
   131    146     set nstar [expr {60 - $n}]
   132    147     set stars [string range $s78 0 $nstar]
   133    148     puts $out "/************** $text $stars/"
   134    149   }
   135    150   
   136    151   # Read the source file named $filename and write it into the
   137    152   # sqlite3.c output file.  If any #include statements are seen,
   138         -# process them approprately.
          153  +# process them appropriately.
   139    154   #
   140    155   proc copy_file {filename} {
   141         -  global seen_hdr available_hdr out addstatic linemacros
          156  +  global seen_hdr available_hdr varonly_hdr cdecllist out addstatic linemacros
   142    157     set ln 0
   143    158     set tail [file tail $filename]
   144    159     section_comment "Begin file $tail"
   145    160     if {$linemacros} {puts $out "#line 1 \"$filename\""}
   146    161     set in [open $filename r]
   147    162     set varpattern {^[a-zA-Z][a-zA-Z_0-9 *]+(sqlite3[_a-zA-Z0-9]+)(\[|;| =)}
   148         -  set declpattern {[a-zA-Z][a-zA-Z_0-9 ]+ \**(sqlite3[_a-zA-Z0-9]+)\(}
          163  +  set declpattern {([a-zA-Z][a-zA-Z_0-9 ]+ \**)(sqlite3[_a-zA-Z0-9]+)(\(.*)}
   149    164     if {[file extension $filename]==".h"} {
   150    165       set declpattern " *$declpattern"
   151    166     }
   152         -  set declpattern ^$declpattern
          167  +  set declpattern ^$declpattern\$
   153    168     while {![eof $in]} {
   154    169       set line [gets $in]
   155    170       incr ln
   156    171       if {[regexp {^\s*#\s*include\s+["<]([^">]+)[">]} $line all hdr]} {
   157    172         if {[info exists available_hdr($hdr)]} {
   158    173           if {$available_hdr($hdr)} {
   159    174             if {$hdr!="os_common.h" && $hdr!="hwtime.h"} {
................................................................................
   161    176             }
   162    177             section_comment "Include $hdr in the middle of $tail"
   163    178             copy_file tsrc/$hdr
   164    179             section_comment "Continuing where we left off in $tail"
   165    180             if {$linemacros} {puts $out "#line [expr {$ln+1}] \"$filename\""}
   166    181           }
   167    182         } elseif {![info exists seen_hdr($hdr)]} {
   168         -        set seen_hdr($hdr) 1
          183  +        if {![regexp {/\*\s+amalgamator:\s+dontcache\s+\*/} $line]} {
          184  +          set seen_hdr($hdr) 1
          185  +        }
          186  +        puts $out $line
          187  +      } elseif {[regexp {/\*\s+amalgamator:\s+keep\s+\*/} $line]} {
          188  +        # This include file must be kept because there was a "keep"
          189  +        # directive inside of a line comment.
   169    190           puts $out $line
   170    191         } else {
   171         -        puts $out "/* $line */"
          192  +        # Comment out the entire line, replacing any nested comment
          193  +        # begin/end markers with the harmless substring "**".
          194  +        puts $out "/* [string map [list /* ** */ **] $line] */"
   172    195         }
   173    196       } elseif {[regexp {^#ifdef __cplusplus} $line]} {
   174    197         puts $out "#if 0"
   175    198       } elseif {!$linemacros && [regexp {^#line} $line]} {
   176    199         # Skip #line directives.
   177    200       } elseif {$addstatic && ![regexp {^(static|typedef)} $line]} {
   178         -      regsub {^SQLITE_API } $line {} line
   179         -      if {[regexp $declpattern $line all funcname]} {
          201  +      # Skip adding the SQLITE_PRIVATE or SQLITE_API keyword before
          202  +      # functions if this header file does not need it.
          203  +      if {![info exists varonly_hdr($tail)]
          204  +       && [regexp $declpattern $line all rettype funcname rest]} {
          205  +        regsub {^SQLITE_API } $line {} line
   180    206           # Add the SQLITE_PRIVATE or SQLITE_API keyword before functions.
   181    207           # so that linkage can be modified at compile-time.
   182    208           if {[regexp {^sqlite3_} $funcname]} {
   183         -          puts $out "SQLITE_API $line"
          209  +          set line SQLITE_API
          210  +          append line " " [string trim $rettype]
          211  +          if {[string index $rettype end] ne "*"} {
          212  +            append line " "
          213  +          }
          214  +          if {[lsearch -exact $cdecllist $funcname] >= 0} {
          215  +            append line SQLITE_CDECL
          216  +          } else {
          217  +            append line SQLITE_STDCALL
          218  +          }
          219  +          append line " " $funcname $rest
          220  +          puts $out $line
   184    221           } else {
   185    222             puts $out "SQLITE_PRIVATE $line"
   186    223           }
   187    224         } elseif {[regexp $varpattern $line all varname]} {
   188         -        # Add the SQLITE_PRIVATE before variable declarations or
   189         -        # definitions for internal use
   190         -        if {![regexp {^sqlite3_} $varname]} {
   191         -          regsub {^extern } $line {} line
   192         -          puts $out "SQLITE_PRIVATE $line"
   193         -        } else {
   194         -          if {[regexp {const char sqlite3_version\[\];} $line]} {
   195         -            set line {const char sqlite3_version[] = SQLITE_VERSION;}
          225  +          # Add the SQLITE_PRIVATE before variable declarations or
          226  +          # definitions for internal use
          227  +          regsub {^SQLITE_API } $line {} line
          228  +          if {![regexp {^sqlite3_} $varname]} {
          229  +            regsub {^extern } $line {} line
          230  +            puts $out "SQLITE_PRIVATE $line"
          231  +          } else {
          232  +            if {[regexp {const char sqlite3_version\[\];} $line]} {
          233  +              set line {const char sqlite3_version[] = SQLITE_VERSION;}
          234  +            }
          235  +            regsub {^SQLITE_EXTERN } $line {} line
          236  +            puts $out "SQLITE_API $line"
   196    237             }
   197         -          regsub {^SQLITE_EXTERN } $line {} line
   198         -          puts $out "SQLITE_API $line"
   199         -        }
   200    238         } elseif {[regexp {^(SQLITE_EXTERN )?void \(\*sqlite3IoTrace\)} $line]} {
          239  +        regsub {^SQLITE_API } $line {} line
   201    240           regsub {^SQLITE_EXTERN } $line {} line
   202         -        puts $out "SQLITE_PRIVATE $line"
          241  +        puts $out $line
   203    242         } elseif {[regexp {^void \(\*sqlite3Os} $line]} {
          243  +        regsub {^SQLITE_API } $line {} line
   204    244           puts $out "SQLITE_PRIVATE $line"
   205    245         } else {
   206    246           puts $out $line
   207    247         }
   208    248       } else {
   209    249         puts $out $line
   210    250       }

Changes to tool/mksqlite3c.tcl.

    76     76   */
    77     77   #define SQLITE_CORE 1
    78     78   #define SQLITE_AMALGAMATION 1}]
    79     79   if {$addstatic} {
    80     80     puts $out \
    81     81   {#ifndef SQLITE_PRIVATE
    82     82   # define SQLITE_PRIVATE static
    83         -#endif
    84         -#ifndef SQLITE_API
    85         -# define SQLITE_API
    86     83   #endif}
    87     84   }
    88     85   
    89     86   # These are the header files used by SQLite.  The first time any of these 
    90     87   # files are seen in a #include statement in the C code, include the complete
    91     88   # text of the file in-line.  The file only needs to be included once.
    92     89   #
................................................................................
   120    117      vdbeInt.h
   121    118      wal.h
   122    119      whereInt.h
   123    120   } {
   124    121     set available_hdr($hdr) 1
   125    122   }
   126    123   set available_hdr(sqliteInt.h) 0
          124  +
          125  +# These headers should be copied into the amalgamation without modifying any
          126  +# of their function declarations or definitions.
          127  +set varonly_hdr(sqlite3.h) 1
          128  +
          129  +# These are the functions that accept a variable number of arguments.  They
          130  +# always need to use the "cdecl" calling convention even when another calling
          131  +# convention (e.g. "stcall") is being used for the rest of the library.
          132  +set cdecllist {
          133  +  sqlite3_config
          134  +  sqlite3_db_config
          135  +  sqlite3_log
          136  +  sqlite3_mprintf
          137  +  sqlite3_snprintf
          138  +  sqlite3_test_control
          139  +  sqlite3_vtab_config
          140  +}
   127    141   
   128    142   # 78 stars used for comment formatting.
   129    143   set s78 \
   130    144   {*****************************************************************************}
   131    145   
   132    146   # Insert a comment into the code
   133    147   #
................................................................................
   140    154   }
   141    155   
   142    156   # Read the source file named $filename and write it into the
   143    157   # sqlite3.c output file.  If any #include statements are seen,
   144    158   # process them appropriately.
   145    159   #
   146    160   proc copy_file {filename} {
   147         -  global seen_hdr available_hdr out addstatic linemacros
          161  +  global seen_hdr available_hdr varonly_hdr cdecllist out addstatic linemacros
   148    162     set ln 0
   149    163     set tail [file tail $filename]
   150    164     section_comment "Begin file $tail"
   151    165     if {$linemacros} {puts $out "#line 1 \"$filename\""}
   152    166     set in [open $filename r]
   153    167     set varpattern {^[a-zA-Z][a-zA-Z_0-9 *]+(sqlite3[_a-zA-Z0-9]+)(\[|;| =)}
   154         -  set declpattern {[a-zA-Z][a-zA-Z_0-9 ]+ \**(sqlite3[_a-zA-Z0-9]+)\(}
          168  +  set declpattern {([a-zA-Z][a-zA-Z_0-9 ]+ \**)(sqlite3[_a-zA-Z0-9]+)(\(.*)}
   155    169     if {[file extension $filename]==".h"} {
   156    170       set declpattern " *$declpattern"
   157    171     }
   158         -  set declpattern ^$declpattern
          172  +  set declpattern ^$declpattern\$
   159    173     while {![eof $in]} {
   160    174       set line [gets $in]
   161    175       incr ln
   162    176       if {[regexp {^\s*#\s*include\s+["<]([^">]+)[">]} $line all hdr]} {
   163    177         if {[info exists available_hdr($hdr)]} {
   164    178           if {$available_hdr($hdr)} {
   165    179             if {$hdr!="os_common.h" && $hdr!="hwtime.h"} {
................................................................................
   185    199           puts $out "/* [string map [list /* ** */ **] $line] */"
   186    200         }
   187    201       } elseif {[regexp {^#ifdef __cplusplus} $line]} {
   188    202         puts $out "#if 0"
   189    203       } elseif {!$linemacros && [regexp {^#line} $line]} {
   190    204         # Skip #line directives.
   191    205       } elseif {$addstatic && ![regexp {^(static|typedef)} $line]} {
   192         -      regsub {^SQLITE_API } $line {} line
   193         -      if {[regexp $declpattern $line all funcname]} {
          206  +      # Skip adding the SQLITE_PRIVATE or SQLITE_API keyword before
          207  +      # functions if this header file does not need it.
          208  +      if {![info exists varonly_hdr($tail)]
          209  +       && [regexp $declpattern $line all rettype funcname rest]} {
          210  +        regsub {^SQLITE_API } $line {} line
   194    211           # Add the SQLITE_PRIVATE or SQLITE_API keyword before functions.
   195    212           # so that linkage can be modified at compile-time.
   196    213           if {[regexp {^sqlite3_} $funcname]} {
   197         -          puts $out "SQLITE_API $line"
          214  +          set line SQLITE_API
          215  +          append line " " [string trim $rettype]
          216  +          if {[string index $rettype end] ne "*"} {
          217  +            append line " "
          218  +          }
          219  +          if {[lsearch -exact $cdecllist $funcname] >= 0} {
          220  +            append line SQLITE_CDECL
          221  +          } else {
          222  +            append line SQLITE_STDCALL
          223  +          }
          224  +          append line " " $funcname $rest
          225  +          puts $out $line
   198    226           } else {
   199    227             puts $out "SQLITE_PRIVATE $line"
   200    228           }
   201    229         } elseif {[regexp $varpattern $line all varname]} {
   202         -        # Add the SQLITE_PRIVATE before variable declarations or
   203         -        # definitions for internal use
   204         -        if {![regexp {^sqlite3_} $varname]} {
   205         -          regsub {^extern } $line {} line
   206         -          puts $out "SQLITE_PRIVATE $line"
   207         -        } else {
   208         -          if {[regexp {const char sqlite3_version\[\];} $line]} {
   209         -            set line {const char sqlite3_version[] = SQLITE_VERSION;}
          230  +          # Add the SQLITE_PRIVATE before variable declarations or
          231  +          # definitions for internal use
          232  +          regsub {^SQLITE_API } $line {} line
          233  +          if {![regexp {^sqlite3_} $varname]} {
          234  +            regsub {^extern } $line {} line
          235  +            puts $out "SQLITE_PRIVATE $line"
          236  +          } else {
          237  +            if {[regexp {const char sqlite3_version\[\];} $line]} {
          238  +              set line {const char sqlite3_version[] = SQLITE_VERSION;}
          239  +            }
          240  +            regsub {^SQLITE_EXTERN } $line {} line
          241  +            puts $out "SQLITE_API $line"
   210    242             }
   211         -          regsub {^SQLITE_EXTERN } $line {} line
   212         -          puts $out "SQLITE_API $line"
   213         -        }
   214    243         } elseif {[regexp {^(SQLITE_EXTERN )?void \(\*sqlite3IoTrace\)} $line]} {
          244  +        regsub {^SQLITE_API } $line {} line
   215    245           regsub {^SQLITE_EXTERN } $line {} line
   216    246           puts $out $line
   217    247         } elseif {[regexp {^void \(\*sqlite3Os} $line]} {
          248  +        regsub {^SQLITE_API } $line {} line
   218    249           puts $out "SQLITE_PRIVATE $line"
   219    250         } else {
   220    251           puts $out $line
   221    252         }
   222    253       } else {
   223    254         puts $out $line
   224    255       }

Changes to tool/mksqlite3h.tcl.

    59     59     }
    60     60   }
    61     61   close $in
    62     62   
    63     63   # Set up patterns for recognizing API declarations.
    64     64   #
    65     65   set varpattern {^[a-zA-Z][a-zA-Z_0-9 *]+sqlite3_[_a-zA-Z0-9]+(\[|;| =)}
    66         -set declpattern {^ *[a-zA-Z][a-zA-Z_0-9 ]+ \**sqlite3_[_a-zA-Z0-9]+\(}
           66  +set declpattern {^ *([a-zA-Z][a-zA-Z_0-9 ]+ \**)(sqlite3_[_a-zA-Z0-9]+)(\(.*)$}
    67     67   
    68     68   # Force the output to use unix line endings, even on Windows.
    69     69   fconfigure stdout -translation lf
    70     70   
    71     71   set filelist [subst {
    72     72     $TOP/src/sqlite.h.in
    73     73     $TOP/ext/rtree/sqlite3rtree.h
    74     74   }]
           75  +
           76  +# These are the functions that accept a variable number of arguments.  They
           77  +# always need to use the "cdecl" calling convention even when another calling
           78  +# convention (e.g. "stcall") is being used for the rest of the library.
           79  +set cdecllist {
           80  +  sqlite3_config
           81  +  sqlite3_db_config
           82  +  sqlite3_log
           83  +  sqlite3_mprintf
           84  +  sqlite3_snprintf
           85  +  sqlite3_test_control
           86  +  sqlite3_vtab_config
           87  +}
    75     88   
    76     89   # Process the source files.
    77     90   #
    78     91   foreach file $filelist {
    79     92     set in [open $file]
    80     93     while {![eof $in]} {
    81     94     
................................................................................
    85     98       # line when copying sqlite3rtree.h into sqlite3.h.
    86     99       #
    87    100       if {[string match {*#include*<sqlite3.h>*} $line]} continue
    88    101     
    89    102       regsub -- --VERS--           $line $zVersion line
    90    103       regsub -- --VERSION-NUMBER-- $line $nVersion line
    91    104       regsub -- --SOURCE-ID--      $line "$zDate $zUuid" line
    92         -  
    93         -    if {[regexp {define SQLITE_EXTERN extern} $line]} {
    94         -      puts $line
    95         -      puts [gets $in]
    96         -      puts ""
    97         -      puts "#ifndef SQLITE_API"
    98         -      puts "# define SQLITE_API"
    99         -      puts "#endif"
   100         -      set line ""
   101         -    }
   102         -  
   103         -    if {([regexp $varpattern $line] && ![regexp {^ *typedef} $line])
   104         -     || ([regexp $declpattern $line])
   105         -    } {
          105  +
          106  +    if {[regexp $varpattern $line] && ![regexp {^ *typedef} $line]} {
   106    107         set line "SQLITE_API $line"
          108  +    } else {
          109  +      if {[regexp $declpattern $line all rettype funcname rest]} {
          110  +        set line SQLITE_API
          111  +        append line " " [string trim $rettype]
          112  +        if {[string index $rettype end] ne "*"} {
          113  +          append line " "
          114  +        }
          115  +        if {[lsearch -exact $cdecllist $funcname] >= 0} {
          116  +          append line SQLITE_CDECL
          117  +        } else {
          118  +          append line SQLITE_STDCALL
          119  +        }
          120  +        append line " " $funcname $rest
          121  +      }
   107    122       }
   108    123       puts $line
   109    124     }
   110    125     close $in
   111    126   }