/ Check-in [02b8040e]
Login

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

Overview
Comment:Work in progress on setting a calling convention for all callback functions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | callbackConv
Files: files | file ages | folders
SHA1: 02b8040e1add02734d2dbc6c59737ab74ff8fb18
User & Date: mistachkin 2016-07-28 04:14:37
Context
2016-07-28
14:37
Allow the 'testfixture.exe' target to be compiled with the __stdcall calling convention. check-in: e8be3dfe user: mistachkin tags: callbackConv
04:14
Work in progress on setting a calling convention for all callback functions. check-in: 02b8040e user: mistachkin tags: callbackConv
2016-07-27
19:30
Enhance the query planner cost estimation for index scans to take into account WHERE clause terms that can be computed using only the index and that do not require looking up rows in the original table. This fixes an obscure performance regression that arose when the ORDER BY LIMIT optimization was added by check-in [bf46179d44843]. check-in: 9e2b2681 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.msc.

   460    460   # also be noted here that building any target with these "stdcall" options
   461    461   # will most likely fail if the Tcl library is also required.  This is due
   462    462   # to how the Tcl library functions are declared and exported (i.e. without
   463    463   # an explicit calling convention, which results in "cdecl").
   464    464   #
   465    465   !IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
   466    466   !IF "$(PLATFORM)"=="x86"
   467         -CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
   468         -SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
          467  +CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
          468  +SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
          469  +TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
   469    470   !ELSE
   470    471   !IFNDEF PLATFORM
   471         -CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
   472         -SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
          472  +CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
          473  +SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
          474  +TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
   473    475   !ELSE
   474    476   CORE_CCONV_OPTS =
   475    477   SHELL_CCONV_OPTS =
          478  +TEST_CCONV_OPTS =
   476    479   !ENDIF
   477    480   !ENDIF
   478    481   !ELSE
   479    482   CORE_CCONV_OPTS =
   480    483   SHELL_CCONV_OPTS =
          484  +TEST_CCONV_OPTS =
   481    485   !ENDIF
   482    486   
   483    487   # These are additional compiler options used for the core library.
   484    488   #
   485    489   !IFNDEF CORE_COMPILE_OPTS
   486    490   !IF $(DYNAMIC_SHELL)!=0 || $(FOR_WIN10)!=0
   487    491   CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport)
................................................................................
  1956   1960   # hidden when the library is built via the amalgamation).
  1957   1961   #
  1958   1962   TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
  1959   1963   TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE=""
  1960   1964   TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN)
  1961   1965   TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERIES_CONSTRAINT_VERIFY=1
  1962   1966   TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_DEFAULT_PAGE_SIZE=1024
         1967  +TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) $(TEST_CCONV_OPTS)
  1963   1968   
  1964   1969   TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2)
  1965   1970   TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C)
  1966   1971   !IF $(USE_AMALGAMATION)==0
  1967   1972   TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0)
  1968   1973   !ELSE
  1969   1974   TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1)

Changes to autoconf/Makefile.msc.

   445    445   # also be noted here that building any target with these "stdcall" options
   446    446   # will most likely fail if the Tcl library is also required.  This is due
   447    447   # to how the Tcl library functions are declared and exported (i.e. without
   448    448   # an explicit calling convention, which results in "cdecl").
   449    449   #
   450    450   !IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
   451    451   !IF "$(PLATFORM)"=="x86"
   452         -CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
   453         -SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
          452  +CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
          453  +SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
   454    454   !ELSE
   455    455   !IFNDEF PLATFORM
   456         -CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
   457         -SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_STDCALL=__stdcall
          456  +CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
          457  +SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
   458    458   !ELSE
   459    459   CORE_CCONV_OPTS =
   460    460   SHELL_CCONV_OPTS =
   461    461   !ENDIF
   462    462   !ENDIF
   463    463   !ELSE
   464    464   CORE_CCONV_OPTS =

Changes to ext/misc/percentile.c.

   163    163     }
   164    164     p->a[p->nUsed++] = y;
   165    165   }
   166    166   
   167    167   /*
   168    168   ** Compare to doubles for sorting using qsort()
   169    169   */
   170         -static int doubleCmp(const void *pA, const void *pB){
          170  +static int SQLITE_CDECL doubleCmp(const void *pA, const void *pB){
   171    171     double a = *(double*)pA;
   172    172     double b = *(double*)pB;
   173    173     if( a==b ) return 0;
   174    174     if( a<b ) return -1;
   175    175     return +1;
   176    176   }
   177    177   

Changes to ext/misc/spellfix.c.

  2227   2227     return iDistance + 32 - iLog2;
  2228   2228   }
  2229   2229   
  2230   2230   /*
  2231   2231   ** Compare two spellfix1_row objects for sorting purposes in qsort() such
  2232   2232   ** that they sort in order of increasing distance.
  2233   2233   */
  2234         -static int spellfix1RowCompare(const void *A, const void *B){
         2234  +static int SQLITE_CDECL spellfix1RowCompare(const void *A, const void *B){
  2235   2235     const struct spellfix1_row *a = (const struct spellfix1_row*)A;
  2236   2236     const struct spellfix1_row *b = (const struct spellfix1_row*)B;
  2237   2237     return a->iScore - b->iScore;
  2238   2238   }
  2239   2239   
  2240   2240   /*
  2241   2241   ** A structure used to pass information from spellfix1FilterForMatch()

Changes to src/sqlite.h.in.

    50     50   #endif
    51     51   #ifndef SQLITE_API
    52     52   # define SQLITE_API
    53     53   #endif
    54     54   #ifndef SQLITE_CDECL
    55     55   # define SQLITE_CDECL
    56     56   #endif
           57  +#ifndef SQLITE_APICALL
           58  +# define SQLITE_APICALL
           59  +#endif
    57     60   #ifndef SQLITE_STDCALL
    58         -# define SQLITE_STDCALL
           61  +# define SQLITE_STDCALL SQLITE_APICALL
    59     62   #endif
           63  +#ifndef SQLITE_CALLBACK
           64  +# define SQLITE_CALLBACK
           65  +#endif
           66  +#ifndef SQLITE_SYSAPI
           67  +# define SQLITE_SYSAPI
           68  +#endif
           69  +
    60     70   
    61     71   /*
    62     72   ** These no-op macros are used in front of interfaces to mark those
    63     73   ** interfaces as either deprecated or experimental.  New applications
    64     74   ** should not use deprecated interfaces - they are supported for backwards
    65     75   ** compatibility only.  Application writers should be aware that
    66     76   ** experimental interfaces are subject to change in point releases.
................................................................................
   314    324   int sqlite3_close_v2(sqlite3*);
   315    325   
   316    326   /*
   317    327   ** The type for a callback function.
   318    328   ** This is legacy and deprecated.  It is included for historical
   319    329   ** compatibility and is not documented.
   320    330   */
   321         -typedef int (*sqlite3_callback)(void*,int,char**, char**);
          331  +typedef int (SQLITE_CALLBACK *sqlite3_callback)(void*,int,char**, char**);
   322    332   
   323    333   /*
   324    334   ** CAPI3REF: One-Step Query Execution Interface
   325    335   ** METHOD: sqlite3
   326    336   **
   327    337   ** The sqlite3_exec() interface is a convenience wrapper around
   328    338   ** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],
................................................................................
   381    391   ** <li> The application must not modify the SQL statement text passed into
   382    392   **      the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
   383    393   ** </ul>
   384    394   */
   385    395   int sqlite3_exec(
   386    396     sqlite3*,                                  /* An open database */
   387    397     const char *sql,                           /* SQL to be evaluated */
   388         -  int (*callback)(void*,int,char**,char**),  /* Callback function */
          398  +  int (SQLITE_CALLBACK *callback)(void*,int,char**,char**), /* Callback func */
   389    399     void *,                                    /* 1st argument to callback */
   390    400     char **errmsg                              /* Error msg written here */
   391    401   );
   392    402   
   393    403   /*
   394    404   ** CAPI3REF: Result Codes
   395    405   ** KEYWORDS: {result code definitions}
................................................................................
   729    739   ** fails to zero-fill short reads might seem to work.  However,
   730    740   ** failure to zero-fill short reads will eventually lead to
   731    741   ** database corruption.
   732    742   */
   733    743   typedef struct sqlite3_io_methods sqlite3_io_methods;
   734    744   struct sqlite3_io_methods {
   735    745     int iVersion;
   736         -  int (*xClose)(sqlite3_file*);
   737         -  int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
   738         -  int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);
   739         -  int (*xTruncate)(sqlite3_file*, sqlite3_int64 size);
   740         -  int (*xSync)(sqlite3_file*, int flags);
   741         -  int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize);
   742         -  int (*xLock)(sqlite3_file*, int);
   743         -  int (*xUnlock)(sqlite3_file*, int);
   744         -  int (*xCheckReservedLock)(sqlite3_file*, int *pResOut);
   745         -  int (*xFileControl)(sqlite3_file*, int op, void *pArg);
   746         -  int (*xSectorSize)(sqlite3_file*);
   747         -  int (*xDeviceCharacteristics)(sqlite3_file*);
          746  +  int (SQLITE_CALLBACK *xClose)(sqlite3_file*);
          747  +  int (SQLITE_CALLBACK *xRead)(sqlite3_file*, void*, int iAmt,
          748  +                               sqlite3_int64 iOfst);
          749  +  int (SQLITE_CALLBACK *xWrite)(sqlite3_file*, const void*, int iAmt,
          750  +                                sqlite3_int64 iOfst);
          751  +  int (SQLITE_CALLBACK *xTruncate)(sqlite3_file*, sqlite3_int64 size);
          752  +  int (SQLITE_CALLBACK *xSync)(sqlite3_file*, int flags);
          753  +  int (SQLITE_CALLBACK *xFileSize)(sqlite3_file*, sqlite3_int64 *pSize);
          754  +  int (SQLITE_CALLBACK *xLock)(sqlite3_file*, int);
          755  +  int (SQLITE_CALLBACK *xUnlock)(sqlite3_file*, int);
          756  +  int (SQLITE_CALLBACK *xCheckReservedLock)(sqlite3_file*, int *pResOut);
          757  +  int (SQLITE_CALLBACK *xFileControl)(sqlite3_file*, int op, void *pArg);
          758  +  int (SQLITE_CALLBACK *xSectorSize)(sqlite3_file*);
          759  +  int (SQLITE_CALLBACK *xDeviceCharacteristics)(sqlite3_file*);
   748    760     /* Methods above are valid for version 1 */
   749         -  int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**);
   750         -  int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);
   751         -  void (*xShmBarrier)(sqlite3_file*);
   752         -  int (*xShmUnmap)(sqlite3_file*, int deleteFlag);
          761  +  int (SQLITE_CALLBACK *xShmMap)(sqlite3_file*, int iPg, int pgsz, int,
          762  +                                 void volatile**);
          763  +  int (SQLITE_CALLBACK *xShmLock)(sqlite3_file*, int offset, int n, int flags);
          764  +  void (SQLITE_CALLBACK *xShmBarrier)(sqlite3_file*);
          765  +  int (SQLITE_CALLBACK *xShmUnmap)(sqlite3_file*, int deleteFlag);
   753    766     /* Methods above are valid for version 2 */
   754         -  int (*xFetch)(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp);
   755         -  int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p);
          767  +  int (SQLITE_CALLBACK *xFetch)(sqlite3_file*, sqlite3_int64 iOfst, int iAmt,
          768  +                                void **pp);
          769  +  int (SQLITE_CALLBACK *xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p);
   756    770     /* Methods above are valid for version 3 */
   757    771     /* Additional methods may be added in future releases */
   758    772   };
   759    773   
   760    774   /*
   761    775   ** CAPI3REF: Standard File Control Opcodes
   762    776   ** KEYWORDS: {file control opcodes} {file control opcode}
................................................................................
  1190   1204   ** varies from one VFS to another, and from one version of the same VFS to the
  1191   1205   ** next.  Applications that use these interfaces must be prepared for any
  1192   1206   ** or all of these interfaces to be NULL or for their behavior to change
  1193   1207   ** from one release to the next.  Applications must not attempt to access
  1194   1208   ** any of these methods if the iVersion of the VFS is less than 3.
  1195   1209   */
  1196   1210   typedef struct sqlite3_vfs sqlite3_vfs;
  1197         -typedef void (*sqlite3_syscall_ptr)(void);
         1211  +typedef void (SQLITE_SYSAPI *sqlite3_syscall_ptr)(void);
  1198   1212   struct sqlite3_vfs {
  1199   1213     int iVersion;            /* Structure version number (currently 3) */
  1200   1214     int szOsFile;            /* Size of subclassed sqlite3_file */
  1201   1215     int mxPathname;          /* Maximum file pathname length */
  1202   1216     sqlite3_vfs *pNext;      /* Next registered VFS */
  1203   1217     const char *zName;       /* Name of this virtual file system */
  1204   1218     void *pAppData;          /* Pointer to application-specific data */
  1205         -  int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*,
         1219  +  int (SQLITE_CALLBACK *xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*,
  1206   1220                  int flags, int *pOutFlags);
  1207         -  int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);
  1208         -  int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut);
  1209         -  int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut);
  1210         -  void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename);
  1211         -  void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg);
  1212         -  void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void);
  1213         -  void (*xDlClose)(sqlite3_vfs*, void*);
  1214         -  int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut);
  1215         -  int (*xSleep)(sqlite3_vfs*, int microseconds);
  1216         -  int (*xCurrentTime)(sqlite3_vfs*, double*);
  1217         -  int (*xGetLastError)(sqlite3_vfs*, int, char *);
         1221  +  int (SQLITE_CALLBACK *xDelete)(sqlite3_vfs*, const char *zName, int syncDir);
         1222  +  int (SQLITE_CALLBACK *xAccess)(sqlite3_vfs*, const char *zName, int flags,
         1223  +                                 int *pResOut);
         1224  +  int (SQLITE_CALLBACK *xFullPathname)(sqlite3_vfs*, const char *zName,
         1225  +                                       int nOut, char *zOut);
         1226  +  void *(SQLITE_CALLBACK *xDlOpen)(sqlite3_vfs*, const char *zFilename);
         1227  +  void (SQLITE_CALLBACK *xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg);
         1228  +  void (*(SQLITE_CALLBACK *xDlSym)(sqlite3_vfs*,void*,
         1229  +                                   const char *zSymbol))(void);
         1230  +  void (SQLITE_CALLBACK *xDlClose)(sqlite3_vfs*, void*);
         1231  +  int (SQLITE_CALLBACK *xRandomness)(sqlite3_vfs*, int nByte, char *zOut);
         1232  +  int (SQLITE_CALLBACK *xSleep)(sqlite3_vfs*, int microseconds);
         1233  +  int (SQLITE_CALLBACK *xCurrentTime)(sqlite3_vfs*, double*);
         1234  +  int (SQLITE_CALLBACK *xGetLastError)(sqlite3_vfs*, int, char *);
  1218   1235     /*
  1219   1236     ** The methods above are in version 1 of the sqlite_vfs object
  1220   1237     ** definition.  Those that follow are added in version 2 or later
  1221   1238     */
  1222         -  int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);
         1239  +  int (SQLITE_CALLBACK *xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);
  1223   1240     /*
  1224   1241     ** The methods above are in versions 1 and 2 of the sqlite_vfs object.
  1225   1242     ** Those below are for version 3 and greater.
  1226   1243     */
  1227         -  int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr);
  1228         -  sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName);
  1229         -  const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName);
         1244  +  int (SQLITE_CALLBACK *xSetSystemCall)(sqlite3_vfs*, const char *zName,
         1245  +                                        sqlite3_syscall_ptr);
         1246  +  sqlite3_syscall_ptr (SQLITE_CALLBACK *xGetSystemCall)(sqlite3_vfs*,
         1247  +                                                        const char *zName);
         1248  +  const char *(SQLITE_CALLBACK *xNextSystemCall)(sqlite3_vfs*,
         1249  +                                                 const char *zName);
  1230   1250     /*
  1231   1251     ** The methods above are in versions 1 through 3 of the sqlite_vfs object.
  1232   1252     ** New fields may be appended in future versions.  The iVersion
  1233   1253     ** value will increment whenever this happens. 
  1234   1254     */
  1235   1255   };
  1236   1256   
................................................................................
  1489   1509   ** serialization.
  1490   1510   **
  1491   1511   ** SQLite will never invoke xInit() more than once without an intervening
  1492   1512   ** call to xShutdown().
  1493   1513   */
  1494   1514   typedef struct sqlite3_mem_methods sqlite3_mem_methods;
  1495   1515   struct sqlite3_mem_methods {
  1496         -  void *(*xMalloc)(int);         /* Memory allocation function */
  1497         -  void (*xFree)(void*);          /* Free a prior allocation */
  1498         -  void *(*xRealloc)(void*,int);  /* Resize an allocation */
  1499         -  int (*xSize)(void*);           /* Return the size of an allocation */
  1500         -  int (*xRoundup)(int);          /* Round up request size to allocation size */
  1501         -  int (*xInit)(void*);           /* Initialize the memory allocator */
  1502         -  void (*xShutdown)(void*);      /* Deinitialize the memory allocator */
         1516  +  void *(SQLITE_CALLBACK *xMalloc)(int); /* Memory allocation function */
         1517  +  void (SQLITE_CALLBACK *xFree)(void*);  /* Free a prior allocation */
         1518  +  void *(SQLITE_CALLBACK *xRealloc)(void*,int); /* Resize an allocation */
         1519  +  int (SQLITE_CALLBACK *xSize)(void*);   /* Return the size of an allocation */
         1520  +  int (SQLITE_CALLBACK *xRoundup)(int);  /* Round up size to allocation size */
         1521  +  int (SQLITE_CALLBACK *xInit)(void*);   /* Initialize the memory allocator */
         1522  +  void (SQLITE_CALLBACK *xShutdown)(void*); /* Deinitialize memory allocator */
  1503   1523     void *pAppData;                /* Argument to xInit() and xShutdown() */
  1504   1524   };
  1505   1525   
  1506   1526   /*
  1507   1527   ** CAPI3REF: Configuration Options
  1508   1528   ** KEYWORDS: {configuration option}
  1509   1529   **
................................................................................
  2229   2249   ** database connection that invoked the busy handler.  In other words,
  2230   2250   ** the busy handler is not reentrant.  Any such actions
  2231   2251   ** result in undefined behavior.
  2232   2252   ** 
  2233   2253   ** A busy handler must not close the database connection
  2234   2254   ** or [prepared statement] that invoked the busy handler.
  2235   2255   */
  2236         -int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
         2256  +int sqlite3_busy_handler(sqlite3*, int(SQLITE_CALLBACK *)(void*,int), void*);
  2237   2257   
  2238   2258   /*
  2239   2259   ** CAPI3REF: Set A Busy Timeout
  2240   2260   ** METHOD: sqlite3
  2241   2261   **
  2242   2262   ** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps
  2243   2263   ** for a specified amount of time when a table is locked.  ^The handler
................................................................................
  2673   2693   ** [sqlite3_prepare()] or its variants.  Authorization is not
  2674   2694   ** performed during statement evaluation in [sqlite3_step()], unless
  2675   2695   ** as stated in the previous paragraph, sqlite3_step() invokes
  2676   2696   ** sqlite3_prepare_v2() to reprepare a statement after a schema change.
  2677   2697   */
  2678   2698   int sqlite3_set_authorizer(
  2679   2699     sqlite3*,
  2680         -  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
         2700  +  int (SQLITE_CALLBACK *xAuth)(void*,int,const char*,const char*,const char*,
         2701  +                               const char*),
  2681   2702     void *pUserData
  2682   2703   );
  2683   2704   
  2684   2705   /*
  2685   2706   ** CAPI3REF: Authorizer Return Codes
  2686   2707   **
  2687   2708   ** The [sqlite3_set_authorizer | authorizer callback function] must
................................................................................
  2780   2801   ** is only capable of millisecond resolution so the six least significant
  2781   2802   ** digits in the time are meaningless.  Future versions of SQLite
  2782   2803   ** might provide greater resolution on the profiler callback.  The
  2783   2804   ** sqlite3_profile() function is considered experimental and is
  2784   2805   ** subject to change in future versions of SQLite.
  2785   2806   */
  2786   2807   SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*,
  2787         -   void(*xTrace)(void*,const char*), void*);
         2808  +   void(SQLITE_CALLBACK *xTrace)(void*,const char*), void*);
  2788   2809   SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,
  2789         -   void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
         2810  +   void(SQLITE_CALLBACK *xProfile)(void*,const char*,sqlite3_uint64), void*);
  2790   2811   
  2791   2812   /*
  2792   2813   ** CAPI3REF: SQL Trace Event Codes
  2793   2814   ** KEYWORDS: SQLITE_TRACE
  2794   2815   **
  2795   2816   ** These constants identify classes of events that can be monitored
  2796   2817   ** using the [sqlite3_trace_v2()] tracing logic.  The third argument
................................................................................
  2873   2894   ** The sqlite3_trace_v2() interface is intended to replace the legacy
  2874   2895   ** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which
  2875   2896   ** are deprecated.
  2876   2897   */
  2877   2898   int sqlite3_trace_v2(
  2878   2899     sqlite3*,
  2879   2900     unsigned uMask,
  2880         -  int(*xCallback)(unsigned,void*,void*,void*),
         2901  +  int(SQLITE_CALLBACK *xCallback)(unsigned,void*,void*,void*),
  2881   2902     void *pCtx
  2882   2903   );
  2883   2904   
  2884   2905   /*
  2885   2906   ** CAPI3REF: Query Progress Callbacks
  2886   2907   ** METHOD: sqlite3
  2887   2908   **
................................................................................
  2909   2930   **
  2910   2931   ** The progress handler callback must not do anything that will modify
  2911   2932   ** the database connection that invoked the progress handler.
  2912   2933   ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
  2913   2934   ** database connections for the meaning of "modify" in this paragraph.
  2914   2935   **
  2915   2936   */
  2916         -void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
         2937  +void sqlite3_progress_handler(sqlite3*,int,int(SQLITE_CALLBACK *)(void*),void*);
  2917   2938   
  2918   2939   /*
  2919   2940   ** CAPI3REF: Opening A New Database Connection
  2920   2941   ** CONSTRUCTOR: sqlite3
  2921   2942   **
  2922   2943   ** ^These routines open an SQLite database file as specified by the 
  2923   2944   ** filename argument. ^The filename argument is interpreted as UTF-8 for
................................................................................
  3740   3761   ** [SQLITE_MAX_LENGTH].
  3741   3762   ** ^[SQLITE_RANGE] is returned if the parameter
  3742   3763   ** index is out of range.  ^[SQLITE_NOMEM] is returned if malloc() fails.
  3743   3764   **
  3744   3765   ** See also: [sqlite3_bind_parameter_count()],
  3745   3766   ** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
  3746   3767   */
  3747         -int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
         3768  +int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n,
         3769  +                      void(SQLITE_CALLBACK *)(void*));
  3748   3770   int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
  3749         -                        void(*)(void*));
         3771  +                        void(SQLITE_CALLBACK *)(void*));
  3750   3772   int sqlite3_bind_double(sqlite3_stmt*, int, double);
  3751   3773   int sqlite3_bind_int(sqlite3_stmt*, int, int);
  3752   3774   int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
  3753   3775   int sqlite3_bind_null(sqlite3_stmt*, int);
  3754         -int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
  3755         -int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
         3776  +int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,
         3777  +                      void(SQLITE_CALLBACK *)(void*));
         3778  +int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int,
         3779  +                        void(SQLITE_CALLBACK *)(void*));
  3756   3780   int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
  3757         -                         void(*)(void*), unsigned char encoding);
         3781  +                        void(SQLITE_CALLBACK *)(void*), unsigned char encoding);
  3758   3782   int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
  3759   3783   int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
  3760   3784   int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
  3761   3785   
  3762   3786   /*
  3763   3787   ** CAPI3REF: Number Of SQL Parameters
  3764   3788   ** METHOD: sqlite3_stmt
................................................................................
  4418   4442   */
  4419   4443   int sqlite3_create_function(
  4420   4444     sqlite3 *db,
  4421   4445     const char *zFunctionName,
  4422   4446     int nArg,
  4423   4447     int eTextRep,
  4424   4448     void *pApp,
  4425         -  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
  4426         -  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
  4427         -  void (*xFinal)(sqlite3_context*)
         4449  +  void (SQLITE_CALLBACK *xFunc)(sqlite3_context*,int,sqlite3_value**),
         4450  +  void (SQLITE_CALLBACK *xStep)(sqlite3_context*,int,sqlite3_value**),
         4451  +  void (SQLITE_CALLBACK *xFinal)(sqlite3_context*)
  4428   4452   );
  4429   4453   int sqlite3_create_function16(
  4430   4454     sqlite3 *db,
  4431   4455     const void *zFunctionName,
  4432   4456     int nArg,
  4433   4457     int eTextRep,
  4434   4458     void *pApp,
  4435         -  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
  4436         -  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
  4437         -  void (*xFinal)(sqlite3_context*)
         4459  +  void (SQLITE_CALLBACK *xFunc)(sqlite3_context*,int,sqlite3_value**),
         4460  +  void (SQLITE_CALLBACK *xStep)(sqlite3_context*,int,sqlite3_value**),
         4461  +  void (SQLITE_CALLBACK *xFinal)(sqlite3_context*)
  4438   4462   );
  4439   4463   int sqlite3_create_function_v2(
  4440   4464     sqlite3 *db,
  4441   4465     const char *zFunctionName,
  4442   4466     int nArg,
  4443   4467     int eTextRep,
  4444   4468     void *pApp,
  4445         -  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
  4446         -  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
  4447         -  void (*xFinal)(sqlite3_context*),
  4448         -  void(*xDestroy)(void*)
         4469  +  void (SQLITE_CALLBACK *xFunc)(sqlite3_context*,int,sqlite3_value**),
         4470  +  void (SQLITE_CALLBACK *xStep)(sqlite3_context*,int,sqlite3_value**),
         4471  +  void (SQLITE_CALLBACK *xFinal)(sqlite3_context*),
         4472  +  void (SQLITE_CALLBACK *xDestroy)(void*)
  4449   4473   );
  4450   4474   
  4451   4475   /*
  4452   4476   ** CAPI3REF: Text Encodings
  4453   4477   **
  4454   4478   ** These constant define integer codes that represent the various
  4455   4479   ** text encodings supported by SQLite.
................................................................................
  4483   4507   */
  4484   4508   #ifndef SQLITE_OMIT_DEPRECATED
  4485   4509   SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);
  4486   4510   SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);
  4487   4511   SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
  4488   4512   SQLITE_DEPRECATED int sqlite3_global_recover(void);
  4489   4513   SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
  4490         -SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
  4491         -                      void*,sqlite3_int64);
         4514  +SQLITE_DEPRECATED int sqlite3_memory_alarm(
         4515  +                              void(SQLITE_CALLBACK *)(void*,sqlite3_int64,int),
         4516  +                              void*,sqlite3_int64);
  4492   4517   #endif
  4493   4518   
  4494   4519   /*
  4495   4520   ** CAPI3REF: Obtaining SQL Values
  4496   4521   ** METHOD: sqlite3_value
  4497   4522   **
  4498   4523   ** The C-language implementation of SQL functions and aggregates uses
................................................................................
  4703   4728   ** function parameters that are compile-time constants, including literal
  4704   4729   ** values and [parameters] and expressions composed from the same.)^
  4705   4730   **
  4706   4731   ** These routines must be called from the same thread in which
  4707   4732   ** the SQL function is running.
  4708   4733   */
  4709   4734   void *sqlite3_get_auxdata(sqlite3_context*, int N);
  4710         -void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
         4735  +void sqlite3_set_auxdata(sqlite3_context*, int N, void*,
         4736  +                         void (SQLITE_CALLBACK *)(void*));
  4711   4737   
  4712   4738   
  4713   4739   /*
  4714   4740   ** CAPI3REF: Constants Defining Special Destructor Behavior
  4715   4741   **
  4716   4742   ** These are special values for the destructor that is passed in as the
  4717   4743   ** final argument to routines like [sqlite3_result_blob()].  ^If the destructor
................................................................................
  4720   4746   ** SQLITE_TRANSIENT value means that the content will likely change in
  4721   4747   ** the near future and that SQLite should make its own private copy of
  4722   4748   ** the content before returning.
  4723   4749   **
  4724   4750   ** The typedef is necessary to work around problems in certain
  4725   4751   ** C++ compilers.
  4726   4752   */
  4727         -typedef void (*sqlite3_destructor_type)(void*);
         4753  +typedef void (SQLITE_CALLBACK *sqlite3_destructor_type)(void*);
  4728   4754   #define SQLITE_STATIC      ((sqlite3_destructor_type)0)
  4729   4755   #define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)
  4730   4756   
  4731   4757   /*
  4732   4758   ** CAPI3REF: Setting The Result Of An SQL Function
  4733   4759   ** METHOD: sqlite3_context
  4734   4760   **
................................................................................
  4839   4865   ** [unprotected sqlite3_value] object is required, so either
  4840   4866   ** kind of [sqlite3_value] object can be used with this interface.
  4841   4867   **
  4842   4868   ** If these routines are called from within the different thread
  4843   4869   ** than the one containing the application-defined function that received
  4844   4870   ** the [sqlite3_context] pointer, the results are undefined.
  4845   4871   */
  4846         -void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
         4872  +void sqlite3_result_blob(sqlite3_context*, const void*, int,
         4873  +                         void(SQLITE_CALLBACK *)(void*));
  4847   4874   void sqlite3_result_blob64(sqlite3_context*,const void*,
  4848         -                           sqlite3_uint64,void(*)(void*));
         4875  +                           sqlite3_uint64,void(SQLITE_CALLBACK *)(void*));
  4849   4876   void sqlite3_result_double(sqlite3_context*, double);
  4850   4877   void sqlite3_result_error(sqlite3_context*, const char*, int);
  4851   4878   void sqlite3_result_error16(sqlite3_context*, const void*, int);
  4852   4879   void sqlite3_result_error_toobig(sqlite3_context*);
  4853   4880   void sqlite3_result_error_nomem(sqlite3_context*);
  4854   4881   void sqlite3_result_error_code(sqlite3_context*, int);
  4855   4882   void sqlite3_result_int(sqlite3_context*, int);
  4856   4883   void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
  4857   4884   void sqlite3_result_null(sqlite3_context*);
  4858         -void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
         4885  +void sqlite3_result_text(sqlite3_context*, const char*, int,
         4886  +                         void(SQLITE_CALLBACK *)(void*));
  4859   4887   void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
  4860         -                           void(*)(void*), unsigned char encoding);
  4861         -void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
  4862         -void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
  4863         -void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
         4888  +                           void(SQLITE_CALLBACK *)(void*),
         4889  +                           unsigned char encoding);
         4890  +void sqlite3_result_text16(sqlite3_context*, const void*, int,
         4891  +                           void(SQLITE_CALLBACK *)(void*));
         4892  +void sqlite3_result_text16le(sqlite3_context*, const void*, int,
         4893  +                             void(SQLITE_CALLBACK *)(void*));
         4894  +void sqlite3_result_text16be(sqlite3_context*, const void*, int,
         4895  +                             void(SQLITE_CALLBACK *)(void*));
  4864   4896   void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
  4865   4897   void sqlite3_result_zeroblob(sqlite3_context*, int n);
  4866   4898   int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
  4867   4899   
  4868   4900   
  4869   4901   /*
  4870   4902   ** CAPI3REF: Setting The Subtype Of An SQL Function
................................................................................
  4961   4993   ** See also:  [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
  4962   4994   */
  4963   4995   int sqlite3_create_collation(
  4964   4996     sqlite3*, 
  4965   4997     const char *zName, 
  4966   4998     int eTextRep, 
  4967   4999     void *pArg,
  4968         -  int(*xCompare)(void*,int,const void*,int,const void*)
         5000  +  int(SQLITE_CALLBACK *xCompare)(void*,int,const void*,int,const void*)
  4969   5001   );
  4970   5002   int sqlite3_create_collation_v2(
  4971   5003     sqlite3*, 
  4972   5004     const char *zName, 
  4973   5005     int eTextRep, 
  4974   5006     void *pArg,
  4975         -  int(*xCompare)(void*,int,const void*,int,const void*),
  4976         -  void(*xDestroy)(void*)
         5007  +  int(SQLITE_CALLBACK *xCompare)(void*,int,const void*,int,const void*),
         5008  +  void(SQLITE_CALLBACK *xDestroy)(void*)
  4977   5009   );
  4978   5010   int sqlite3_create_collation16(
  4979   5011     sqlite3*, 
  4980   5012     const void *zName,
  4981   5013     int eTextRep, 
  4982   5014     void *pArg,
  4983         -  int(*xCompare)(void*,int,const void*,int,const void*)
         5015  +  int(SQLITE_CALLBACK *xCompare)(void*,int,const void*,int,const void*)
  4984   5016   );
  4985   5017   
  4986   5018   /*
  4987   5019   ** CAPI3REF: Collation Needed Callbacks
  4988   5020   ** METHOD: sqlite3
  4989   5021   **
  4990   5022   ** ^To avoid having to register all collation sequences before a database
................................................................................
  5009   5041   ** The callback function should register the desired collation using
  5010   5042   ** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
  5011   5043   ** [sqlite3_create_collation_v2()].
  5012   5044   */
  5013   5045   int sqlite3_collation_needed(
  5014   5046     sqlite3*, 
  5015   5047     void*, 
  5016         -  void(*)(void*,sqlite3*,int eTextRep,const char*)
         5048  +  void(SQLITE_CALLBACK *)(void*,sqlite3*,int eTextRep,const char*)
  5017   5049   );
  5018   5050   int sqlite3_collation_needed16(
  5019   5051     sqlite3*, 
  5020   5052     void*,
  5021         -  void(*)(void*,sqlite3*,int eTextRep,const void*)
         5053  +  void(SQLITE_CALLBACK *)(void*,sqlite3*,int eTextRep,const void*)
  5022   5054   );
  5023   5055   
  5024   5056   #ifdef SQLITE_HAS_CODEC
  5025   5057   /*
  5026   5058   ** Specify the key for an encrypted database.  This routine should be
  5027   5059   ** called right after sqlite3_open().
  5028   5060   **
................................................................................
  5313   5345   ** rolled back if an explicit "ROLLBACK" statement is executed, or
  5314   5346   ** an error or constraint causes an implicit rollback to occur.
  5315   5347   ** ^The rollback callback is not invoked if a transaction is
  5316   5348   ** automatically rolled back because the database connection is closed.
  5317   5349   **
  5318   5350   ** See also the [sqlite3_update_hook()] interface.
  5319   5351   */
  5320         -void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
  5321         -void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
         5352  +void *sqlite3_commit_hook(sqlite3*, int(SQLITE_CALLBACK *)(void*), void*);
         5353  +void *sqlite3_rollback_hook(sqlite3*, void(SQLITE_CALLBACK *)(void *), void*);
  5322   5354   
  5323   5355   /*
  5324   5356   ** CAPI3REF: Data Change Notification Callbacks
  5325   5357   ** METHOD: sqlite3
  5326   5358   **
  5327   5359   ** ^The sqlite3_update_hook() interface registers a callback function
  5328   5360   ** with the [database connection] identified by the first argument
................................................................................
  5367   5399   ** the first call on D.
  5368   5400   **
  5369   5401   ** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()],
  5370   5402   ** and [sqlite3_preupdate_hook()] interfaces.
  5371   5403   */
  5372   5404   void *sqlite3_update_hook(
  5373   5405     sqlite3*, 
  5374         -  void(*)(void *,int ,char const *,char const *,sqlite3_int64),
         5406  +  void(SQLITE_CALLBACK *)(void *,int ,char const *,char const *,sqlite3_int64),
  5375   5407     void*
  5376   5408   );
  5377   5409   
  5378   5410   /*
  5379   5411   ** CAPI3REF: Enable Or Disable Shared Pager Cache
  5380   5412   **
  5381   5413   ** ^(This routine enables or disables the sharing of the database cache
................................................................................
  5694   5726   ** ^Calling sqlite3_auto_extension(X) with an entry point X that is already
  5695   5727   ** on the list of automatic extensions is a harmless no-op. ^No entry point
  5696   5728   ** will be called more than once for each database connection that is opened.
  5697   5729   **
  5698   5730   ** See also: [sqlite3_reset_auto_extension()]
  5699   5731   ** and [sqlite3_cancel_auto_extension()]
  5700   5732   */
  5701         -int sqlite3_auto_extension(void (*xEntryPoint)(void));
         5733  +int sqlite3_auto_extension(void (SQLITE_CALLBACK *xEntryPoint)(void));
  5702   5734   
  5703   5735   /*
  5704   5736   ** CAPI3REF: Cancel Automatic Extension Loading
  5705   5737   **
  5706   5738   ** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
  5707   5739   ** initialization routine X that was registered using a prior call to
  5708   5740   ** [sqlite3_auto_extension(X)].  ^The [sqlite3_cancel_auto_extension(X)]
  5709   5741   ** routine returns 1 if initialization routine X was successfully 
  5710   5742   ** unregistered and it returns 0 if X was not on the list of initialization
  5711   5743   ** routines.
  5712   5744   */
  5713         -int sqlite3_cancel_auto_extension(void (*xEntryPoint)(void));
         5745  +int sqlite3_cancel_auto_extension(void (SQLITE_CALLBACK *xEntryPoint)(void));
  5714   5746   
  5715   5747   /*
  5716   5748   ** CAPI3REF: Reset Automatic Extension Loading
  5717   5749   **
  5718   5750   ** ^This interface disables all automatic extensions previously
  5719   5751   ** registered using [sqlite3_auto_extension()].
  5720   5752   */
................................................................................
  5751   5783   ** ^The registration remains valid until it is replaced by a different
  5752   5784   ** module or until the [database connection] closes.  The content
  5753   5785   ** of this structure must not change while it is registered with
  5754   5786   ** any database connection.
  5755   5787   */
  5756   5788   struct sqlite3_module {
  5757   5789     int iVersion;
  5758         -  int (*xCreate)(sqlite3*, void *pAux,
         5790  +  int (SQLITE_CALLBACK *xCreate)(sqlite3*, void *pAux,
  5759   5791                  int argc, const char *const*argv,
  5760   5792                  sqlite3_vtab **ppVTab, char**);
  5761         -  int (*xConnect)(sqlite3*, void *pAux,
         5793  +  int (SQLITE_CALLBACK *xConnect)(sqlite3*, void *pAux,
  5762   5794                  int argc, const char *const*argv,
  5763   5795                  sqlite3_vtab **ppVTab, char**);
  5764         -  int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);
  5765         -  int (*xDisconnect)(sqlite3_vtab *pVTab);
  5766         -  int (*xDestroy)(sqlite3_vtab *pVTab);
  5767         -  int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor);
  5768         -  int (*xClose)(sqlite3_vtab_cursor*);
  5769         -  int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr,
  5770         -                int argc, sqlite3_value **argv);
  5771         -  int (*xNext)(sqlite3_vtab_cursor*);
  5772         -  int (*xEof)(sqlite3_vtab_cursor*);
  5773         -  int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int);
  5774         -  int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid);
  5775         -  int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *);
  5776         -  int (*xBegin)(sqlite3_vtab *pVTab);
  5777         -  int (*xSync)(sqlite3_vtab *pVTab);
  5778         -  int (*xCommit)(sqlite3_vtab *pVTab);
  5779         -  int (*xRollback)(sqlite3_vtab *pVTab);
  5780         -  int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName,
  5781         -                       void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
  5782         -                       void **ppArg);
  5783         -  int (*xRename)(sqlite3_vtab *pVtab, const char *zNew);
         5796  +  int (SQLITE_CALLBACK *xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);
         5797  +  int (SQLITE_CALLBACK *xDisconnect)(sqlite3_vtab *pVTab);
         5798  +  int (SQLITE_CALLBACK *xDestroy)(sqlite3_vtab *pVTab);
         5799  +  int (SQLITE_CALLBACK *xOpen)(sqlite3_vtab *pVTab,
         5800  +                               sqlite3_vtab_cursor **ppCursor);
         5801  +  int (SQLITE_CALLBACK *xClose)(sqlite3_vtab_cursor*);
         5802  +  int (SQLITE_CALLBACK *xFilter)(sqlite3_vtab_cursor*,
         5803  +                                 int idxNum, const char *idxStr,
         5804  +                                 int argc, sqlite3_value **argv);
         5805  +  int (SQLITE_CALLBACK *xNext)(sqlite3_vtab_cursor*);
         5806  +  int (SQLITE_CALLBACK *xEof)(sqlite3_vtab_cursor*);
         5807  +  int (SQLITE_CALLBACK *xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int);
         5808  +  int (SQLITE_CALLBACK *xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid);
         5809  +  int (SQLITE_CALLBACK *xUpdate)(sqlite3_vtab *, int, sqlite3_value **,
         5810  +                                 sqlite3_int64 *);
         5811  +  int (SQLITE_CALLBACK *xBegin)(sqlite3_vtab *pVTab);
         5812  +  int (SQLITE_CALLBACK *xSync)(sqlite3_vtab *pVTab);
         5813  +  int (SQLITE_CALLBACK *xCommit)(sqlite3_vtab *pVTab);
         5814  +  int (SQLITE_CALLBACK *xRollback)(sqlite3_vtab *pVTab);
         5815  +  int (SQLITE_CALLBACK *xFindFunction)(sqlite3_vtab *pVtab,
         5816  +                                       int nArg, const char *zName,
         5817  +         void (SQLITE_CALLBACK **pxFunc)(sqlite3_context*,int,sqlite3_value**),
         5818  +                                       void **ppArg);
         5819  +  int (SQLITE_CALLBACK *xRename)(sqlite3_vtab *pVtab, const char *zNew);
  5784   5820     /* The methods above are in version 1 of the sqlite_module object. Those 
  5785   5821     ** below are for version 2 and greater. */
  5786         -  int (*xSavepoint)(sqlite3_vtab *pVTab, int);
  5787         -  int (*xRelease)(sqlite3_vtab *pVTab, int);
  5788         -  int (*xRollbackTo)(sqlite3_vtab *pVTab, int);
         5822  +  int (SQLITE_CALLBACK *xSavepoint)(sqlite3_vtab *pVTab, int);
         5823  +  int (SQLITE_CALLBACK *xRelease)(sqlite3_vtab *pVTab, int);
         5824  +  int (SQLITE_CALLBACK *xRollbackTo)(sqlite3_vtab *pVTab, int);
  5789   5825   };
  5790   5826   
  5791   5827   /*
  5792   5828   ** CAPI3REF: Virtual Table Indexing Information
  5793   5829   ** KEYWORDS: sqlite3_index_info
  5794   5830   **
  5795   5831   ** The sqlite3_index_info structure and its substructures is used as part
................................................................................
  5970   6006     void *pClientData          /* Client data for xCreate/xConnect */
  5971   6007   );
  5972   6008   int sqlite3_create_module_v2(
  5973   6009     sqlite3 *db,               /* SQLite connection to register module with */
  5974   6010     const char *zName,         /* Name of the module */
  5975   6011     const sqlite3_module *p,   /* Methods for the module */
  5976   6012     void *pClientData,         /* Client data for xCreate/xConnect */
  5977         -  void(*xDestroy)(void*)     /* Module destructor function */
         6013  +  void(SQLITE_CALLBACK *xDestroy)(void*)     /* Module destructor function */
  5978   6014   );
  5979   6015   
  5980   6016   /*
  5981   6017   ** CAPI3REF: Virtual Table Instance Object
  5982   6018   ** KEYWORDS: sqlite3_vtab
  5983   6019   **
  5984   6020   ** Every [virtual table module] implementation uses a subclass
................................................................................
  6511   6547   ** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
  6512   6548   ** called, but only if the prior call to xMutexInit returned SQLITE_OK.
  6513   6549   ** If xMutexInit fails in any way, it is expected to clean up after itself
  6514   6550   ** prior to returning.
  6515   6551   */
  6516   6552   typedef struct sqlite3_mutex_methods sqlite3_mutex_methods;
  6517   6553   struct sqlite3_mutex_methods {
  6518         -  int (*xMutexInit)(void);
  6519         -  int (*xMutexEnd)(void);
  6520         -  sqlite3_mutex *(*xMutexAlloc)(int);
  6521         -  void (*xMutexFree)(sqlite3_mutex *);
  6522         -  void (*xMutexEnter)(sqlite3_mutex *);
  6523         -  int (*xMutexTry)(sqlite3_mutex *);
  6524         -  void (*xMutexLeave)(sqlite3_mutex *);
  6525         -  int (*xMutexHeld)(sqlite3_mutex *);
  6526         -  int (*xMutexNotheld)(sqlite3_mutex *);
         6554  +  int (SQLITE_CALLBACK *xMutexInit)(void);
         6555  +  int (SQLITE_CALLBACK *xMutexEnd)(void);
         6556  +  sqlite3_mutex *(SQLITE_CALLBACK *xMutexAlloc)(int);
         6557  +  void (SQLITE_CALLBACK *xMutexFree)(sqlite3_mutex *);
         6558  +  void (SQLITE_CALLBACK *xMutexEnter)(sqlite3_mutex *);
         6559  +  int (SQLITE_CALLBACK *xMutexTry)(sqlite3_mutex *);
         6560  +  void (SQLITE_CALLBACK *xMutexLeave)(sqlite3_mutex *);
         6561  +  int (SQLITE_CALLBACK *xMutexHeld)(sqlite3_mutex *);
         6562  +  int (SQLITE_CALLBACK *xMutexNotheld)(sqlite3_mutex *);
  6527   6563   };
  6528   6564   
  6529   6565   /*
  6530   6566   ** CAPI3REF: Mutex Verification Routines
  6531   6567   **
  6532   6568   ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
  6533   6569   ** are intended for use inside assert() statements.  The SQLite core
................................................................................
  7215   7251   ** is not obligated to free any memory, but well-behaved implementations should
  7216   7252   ** do their best.
  7217   7253   */
  7218   7254   typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2;
  7219   7255   struct sqlite3_pcache_methods2 {
  7220   7256     int iVersion;
  7221   7257     void *pArg;
  7222         -  int (*xInit)(void*);
  7223         -  void (*xShutdown)(void*);
  7224         -  sqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable);
  7225         -  void (*xCachesize)(sqlite3_pcache*, int nCachesize);
  7226         -  int (*xPagecount)(sqlite3_pcache*);
  7227         -  sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);
  7228         -  void (*xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*, int discard);
  7229         -  void (*xRekey)(sqlite3_pcache*, sqlite3_pcache_page*, 
  7230         -      unsigned oldKey, unsigned newKey);
  7231         -  void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);
  7232         -  void (*xDestroy)(sqlite3_pcache*);
  7233         -  void (*xShrink)(sqlite3_pcache*);
         7258  +  int (SQLITE_CALLBACK *xInit)(void*);
         7259  +  void (SQLITE_CALLBACK *xShutdown)(void*);
         7260  +  sqlite3_pcache *(SQLITE_CALLBACK *xCreate)(int szPage, int szExtra,
         7261  +                                             int bPurgeable);
         7262  +  void (SQLITE_CALLBACK *xCachesize)(sqlite3_pcache*, int nCachesize);
         7263  +  int (SQLITE_CALLBACK *xPagecount)(sqlite3_pcache*);
         7264  +  sqlite3_pcache_page *(SQLITE_CALLBACK *xFetch)(sqlite3_pcache*, unsigned key,
         7265  +                                                 int createFlag);
         7266  +  void (SQLITE_CALLBACK *xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*,
         7267  +                                 int discard);
         7268  +  void (SQLITE_CALLBACK *xRekey)(sqlite3_pcache*, sqlite3_pcache_page*, 
         7269  +                                 unsigned oldKey, unsigned newKey);
         7270  +  void (SQLITE_CALLBACK *xTruncate)(sqlite3_pcache*, unsigned iLimit);
         7271  +  void (SQLITE_CALLBACK *xDestroy)(sqlite3_pcache*);
         7272  +  void (SQLITE_CALLBACK *xShrink)(sqlite3_pcache*);
  7234   7273   };
  7235   7274   
  7236   7275   /*
  7237   7276   ** This is the obsolete pcache_methods object that has now been replaced
  7238   7277   ** by sqlite3_pcache_methods2.  This object is not used by SQLite.  It is
  7239   7278   ** retained in the header file for backwards compatibility only.
  7240   7279   */
  7241   7280   typedef struct sqlite3_pcache_methods sqlite3_pcache_methods;
  7242   7281   struct sqlite3_pcache_methods {
  7243   7282     void *pArg;
  7244         -  int (*xInit)(void*);
  7245         -  void (*xShutdown)(void*);
  7246         -  sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable);
  7247         -  void (*xCachesize)(sqlite3_pcache*, int nCachesize);
  7248         -  int (*xPagecount)(sqlite3_pcache*);
  7249         -  void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);
  7250         -  void (*xUnpin)(sqlite3_pcache*, void*, int discard);
  7251         -  void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey);
  7252         -  void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);
  7253         -  void (*xDestroy)(sqlite3_pcache*);
         7283  +  int (SQLITE_CALLBACK *xInit)(void*);
         7284  +  void (SQLITE_CALLBACK *xShutdown)(void*);
         7285  +  sqlite3_pcache *(SQLITE_CALLBACK *xCreate)(int szPage, int bPurgeable);
         7286  +  void (SQLITE_CALLBACK *xCachesize)(sqlite3_pcache*, int nCachesize);
         7287  +  int (SQLITE_CALLBACK *xPagecount)(sqlite3_pcache*);
         7288  +  void *(SQLITE_CALLBACK *xFetch)(sqlite3_pcache*, unsigned key,
         7289  +                                  int createFlag);
         7290  +  void (SQLITE_CALLBACK *xUnpin)(sqlite3_pcache*, void*, int discard);
         7291  +  void (SQLITE_CALLBACK *xRekey)(sqlite3_pcache*, void*, unsigned oldKey,
         7292  +                                 unsigned newKey);
         7293  +  void (SQLITE_CALLBACK *xTruncate)(sqlite3_pcache*, unsigned iLimit);
         7294  +  void (SQLITE_CALLBACK *xDestroy)(sqlite3_pcache*);
  7254   7295   };
  7255   7296   
  7256   7297   
  7257   7298   /*
  7258   7299   ** CAPI3REF: Online Backup Object
  7259   7300   **
  7260   7301   ** The sqlite3_backup object records state information about an ongoing
................................................................................
  7576   7617   ** by an sqlite3_step() call. ^(If there is a blocking connection, then the
  7577   7618   ** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in
  7578   7619   ** the special "DROP TABLE/INDEX" case, the extended error code is just 
  7579   7620   ** SQLITE_LOCKED.)^
  7580   7621   */
  7581   7622   int sqlite3_unlock_notify(
  7582   7623     sqlite3 *pBlocked,                          /* Waiting connection */
  7583         -  void (*xNotify)(void **apArg, int nArg),    /* Callback function to invoke */
         7624  +  void (SQLITE_CALLBACK *xNotify)(void **apArg, int nArg), /* Callback func */
  7584   7625     void *pNotifyArg                            /* Argument to pass to xNotify */
  7585   7626   );
  7586   7627   
  7587   7628   
  7588   7629   /*
  7589   7630   ** CAPI3REF: String Comparison
  7590   7631   **
................................................................................
  7691   7732   ** previously registered write-ahead log callback. ^Note that the
  7692   7733   ** [sqlite3_wal_autocheckpoint()] interface and the
  7693   7734   ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
  7694   7735   ** overwrite any prior [sqlite3_wal_hook()] settings.
  7695   7736   */
  7696   7737   void *sqlite3_wal_hook(
  7697   7738     sqlite3*, 
  7698         -  int(*)(void *,sqlite3*,const char*,int),
         7739  +  int(SQLITE_CALLBACK *)(void *,sqlite3*,const char*,int),
  7699   7740     void*
  7700   7741   );
  7701   7742   
  7702   7743   /*
  7703   7744   ** CAPI3REF: Configure an auto-checkpoint
  7704   7745   ** METHOD: sqlite3
  7705   7746   **
................................................................................
  8164   8205   ** triggers; or 2 for changes resulting from triggers called by top-level
  8165   8206   ** triggers; and so forth.
  8166   8207   **
  8167   8208   ** See also:  [sqlite3_update_hook()]
  8168   8209   */
  8169   8210   SQLITE_EXPERIMENTAL void *sqlite3_preupdate_hook(
  8170   8211     sqlite3 *db,
  8171         -  void(*xPreUpdate)(
         8212  +  void(SQLITE_CALLBACK *xPreUpdate)(
  8172   8213       void *pCtx,                   /* Copy of third arg to preupdate_hook() */
  8173   8214       sqlite3 *db,                  /* Database handle */
  8174   8215       int op,                       /* SQLITE_UPDATE, DELETE or INSERT */
  8175   8216       char const *zDb,              /* Database name */
  8176   8217       char const *zName,            /* Table name */
  8177   8218       sqlite3_int64 iKey1,          /* Rowid of row about to be deleted/updated */
  8178   8219       sqlite3_int64 iKey2           /* New rowid value (for a rowid UPDATE) */

Changes to src/tclsqlite.c.

  4163   4163   
  4164   4164   /* Needed for the setrlimit() system call on unix */
  4165   4165   #if defined(unix)
  4166   4166   #include <sys/resource.h>
  4167   4167   #endif
  4168   4168   
  4169   4169   #define TCLSH_MAIN main   /* Needed to fake out mktclapp */
  4170         -int TCLSH_MAIN(int argc, char **argv){
         4170  +int SQLITE_CDECL TCLSH_MAIN(int argc, char **argv){
  4171   4171     Tcl_Interp *interp;
  4172   4172   
  4173   4173   #if !defined(_WIN32_WCE)
  4174   4174     if( getenv("BREAK") ){
  4175   4175       fprintf(stderr,
  4176   4176           "attach debugger to process %d and press any key to continue.\n",
  4177   4177           GETPID());

Changes to src/test1.c.

  6440   6440   
  6441   6441   
  6442   6442   #if SQLITE_OS_WIN
  6443   6443   #include <process.h>
  6444   6444   /*
  6445   6445   ** The background thread that does file locking.
  6446   6446   */
  6447         -static void win32_file_locker(void *pAppData){
         6447  +static void SQLITE_CDECL win32_file_locker(void *pAppData){
  6448   6448     struct win32FileLocker *p = (struct win32FileLocker*)pAppData;
  6449   6449     if( p->evName ){
  6450   6450       HANDLE ev = OpenEvent(EVENT_MODIFY_STATE, FALSE, p->evName);
  6451   6451       if ( ev ){
  6452   6452         SetEvent(ev);
  6453   6453         CloseHandle(ev);
  6454   6454       }

Changes to tool/mksqlite3c-noext.tcl.

   216    216             append line " " [string trim $rettype]
   217    217             if {[string index $rettype end] ne "*"} {
   218    218               append line " "
   219    219             }
   220    220             if {[lsearch -exact $cdecllist $funcname] >= 0} {
   221    221               append line SQLITE_CDECL
   222    222             } else {
   223         -            append line SQLITE_STDCALL
          223  +            append line SQLITE_APICALL
   224    224             }
   225    225             append line " " $funcname $rest
   226    226             puts $out $line
   227    227           } else {
   228    228             puts $out "SQLITE_PRIVATE $line"
   229    229           }
   230    230         } elseif {[regexp $varpattern $line all varname]} {

Changes to tool/mksqlite3c.tcl.

   228    228             append line " " [string trim $rettype]
   229    229             if {[string index $rettype end] ne "*"} {
   230    230               append line " "
   231    231             }
   232    232             if {[lsearch -exact $cdecllist $funcname] >= 0} {
   233    233               append line SQLITE_CDECL
   234    234             } else {
   235         -            append line SQLITE_STDCALL
          235  +            append line SQLITE_APICALL
   236    236             }
   237    237             append line " " $funcname $rest
   238    238             puts $out $line
   239    239           } else {
   240    240             puts $out "SQLITE_PRIVATE $line"
   241    241           }
   242    242         } elseif {[regexp $varpattern $line all varname]} {

Changes to tool/mksqlite3h.tcl.

   116    116           append line " " [string trim $rettype]
   117    117           if {[string index $rettype end] ne "*"} {
   118    118             append line " "
   119    119           }
   120    120           if {[lsearch -exact $cdecllist $funcname] >= 0} {
   121    121             append line SQLITE_CDECL
   122    122           } else {
   123         -          append line SQLITE_STDCALL
          123  +          append line SQLITE_APICALL
   124    124           }
   125    125           append line " " $funcname $rest
   126    126         }
   127    127       }
   128    128       puts $line
   129    129     }
   130    130     close $in
   131    131     if {![regexp {sqlite\.h\.in} $file]} {
   132    132       puts "/******** End of [file tail $file] *********/"
   133    133     }
   134    134   }