/ Check-in [3ea567c4]
Login

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

Overview
Comment:Make the extension auto-loading mechanism work with the __stdcall calling convention. Also, fix a couple Tcl command calling conventions missed in the previous check-in.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | callbackConv
Files: files | file ages | folders
SHA1: 3ea567c4b07b2a7a027b9b5cb8250ab687803698
User & Date: mistachkin 2016-07-28 22:23:26
Context
2016-07-28
22:38
Make sure all the auto-extension mechanism function signatures match up precisely. check-in: 87ba69b5 user: mistachkin tags: callbackConv
22:23
Make the extension auto-loading mechanism work with the __stdcall calling convention. Also, fix a couple Tcl command calling conventions missed in the previous check-in. check-in: 3ea567c4 user: mistachkin tags: callbackConv
19:28
The 'sqlite3ext.h' content should be processed before being included in the amalgamation. check-in: cbe1de47 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.msc.

    19     19   # <</mark>>
    20     20   
    21     21   # Set this non-0 to enable full warnings (-W4, etc) when compiling.
    22     22   #
    23     23   !IFNDEF USE_FULLWARN
    24     24   USE_FULLWARN = 0
    25     25   !ENDIF
           26  +
           27  +# Set this non-0 to enable full runtime error checks (-RTC1, etc).  This
           28  +# has no effect if (any) optimizations are enabled.
           29  +#
           30  +!IFNDEF USE_RUNTIME_CHECKS
           31  +USE_RUNTIME_CHECKS = 0
           32  +!ENDIF
    26     33   
    27     34   # Set this non-0 to use "stdcall" calling convention for the core library
    28     35   # and shell executable.
    29     36   #
    30     37   !IFNDEF USE_STDCALL
    31     38   USE_STDCALL = 0
    32     39   !ENDIF
................................................................................
   843    850   
   844    851   # If optimizations are enabled or disabled (either implicitly or
   845    852   # explicitly), add the necessary flags.
   846    853   #
   847    854   !IF $(DEBUG)>1 || $(OPTIMIZATIONS)==0
   848    855   TCC = $(TCC) -Od
   849    856   BCC = $(BCC) -Od
          857  +!IF $(USE_RUNTIME_CHECKS)!=0
          858  +TCC = $(TCC) -RTC1
          859  +BCC = $(BCC) -RTC1
          860  +!ENDIF
   850    861   !ELSEIF $(OPTIMIZATIONS)>=3
   851    862   TCC = $(TCC) -Ox
   852    863   BCC = $(BCC) -Ox
   853    864   !ELSEIF $(OPTIMIZATIONS)==2
   854    865   TCC = $(TCC) -O2
   855    866   BCC = $(BCC) -O2
   856    867   !ELSEIF $(OPTIMIZATIONS)==1

Changes to ext/misc/vfsstat.c.

   805    805   ){
   806    806     int rc = SQLITE_OK;
   807    807     SQLITE_EXTENSION_INIT2(pApi);
   808    808     vstat_vfs.pVfs = sqlite3_vfs_find(0);
   809    809     vstat_vfs.base.szOsFile = sizeof(VStatFile) + vstat_vfs.pVfs->szOsFile;
   810    810     rc = sqlite3_vfs_register(&vstat_vfs.base, 1);
   811    811     if( rc==SQLITE_OK ){
   812         -    rc = sqlite3_auto_extension((void(*)(void))vstatRegister);
          812  +    rc = sqlite3_auto_extension(vstatRegister);
   813    813     }
   814    814     if( rc==SQLITE_OK ) rc = SQLITE_OK_LOAD_PERMANENTLY;
   815    815     return rc;
   816    816   }

Changes to src/loadext.c.

    17     17     #define SQLITE_CORE 1  /* Disable the API redefinition in sqlite3ext.h */
    18     18   #endif
    19     19   #include "sqlite3ext.h"
    20     20   #include "sqliteInt.h"
    21     21   #include <string.h>
    22     22   
    23     23   #ifndef SQLITE_OMIT_LOAD_EXTENSION
           24  +/*
           25  +** This is the function signature used for all extension entry points.
           26  +*/
           27  +typedef int (*sqlite3_loadext_entry)(
           28  +  sqlite3 *db,                       /* Handle to the database. */
           29  +  char **pzErrMsg,                   /* Used to set error string on failure. */
           30  +  const sqlite3_api_routines *pThunk /* Extension API function pointers. */
           31  +);
    24     32   
    25     33   /*
    26     34   ** Some API routines are omitted when various features are
    27     35   ** excluded from a build of SQLite.  Substitute a NULL pointer
    28     36   ** for any missing APIs.
    29     37   */
    30     38   #ifndef SQLITE_ENABLE_COLUMN_METADATA
................................................................................
   106    114   #define sqlite3_blob_bytes     0
   107    115   #define sqlite3_blob_close     0
   108    116   #define sqlite3_blob_open      0
   109    117   #define sqlite3_blob_read      0
   110    118   #define sqlite3_blob_write     0
   111    119   #define sqlite3_blob_reopen    0
   112    120   #endif
          121  +
          122  +#if defined(SQLITE_OMIT_TRACE)
          123  +# define sqlite3_trace_v2      0
          124  +#endif
   113    125   
   114    126   /*
   115    127   ** The following structure contains pointers to all SQLite API routines.
   116    128   ** A pointer to this structure is passed into extensions when they are
   117    129   ** loaded so that the extension can make calls back into the SQLite
   118    130   ** library.
   119    131   **
................................................................................
   412    424     sqlite3_value_subtype,
   413    425     sqlite3_result_subtype,
   414    426     /* Version 3.10.0 and later */
   415    427     sqlite3_status64,
   416    428     sqlite3_strlike,
   417    429     sqlite3_db_cacheflush,
   418    430     /* Version 3.12.0 and later */
   419         -  sqlite3_system_errno
          431  +  sqlite3_system_errno,
          432  +  /* Version 3.14.0 and later */
          433  +  sqlite3_trace_v2,
          434  +  sqlite3_expanded_sql
   420    435   };
   421    436   
   422    437   /*
   423    438   ** Attempt to load an SQLite extension library contained in the file
   424    439   ** zFile.  The entry point is zProc.  zProc may be 0 in which case a
   425    440   ** default entry point name (sqlite3_extension_init) is used.  Use
   426    441   ** of the default name is recommended.
................................................................................
   435    450     sqlite3 *db,          /* Load the extension into this database connection */
   436    451     const char *zFile,    /* Name of the shared library containing extension */
   437    452     const char *zProc,    /* Entry point.  Use "sqlite3_extension_init" if 0 */
   438    453     char **pzErrMsg       /* Put error message here if not 0 */
   439    454   ){
   440    455     sqlite3_vfs *pVfs = db->pVfs;
   441    456     void *handle;
   442         -  int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*);
          457  +  sqlite3_loadext_entry xInit;
   443    458     char *zErrmsg = 0;
   444    459     const char *zEntry;
   445    460     char *zAltEntry = 0;
   446    461     void **aHandle;
   447    462     u64 nMsg = 300 + sqlite3Strlen30(zFile);
   448    463     int ii;
   449    464     int rc;
................................................................................
   494    509           sqlite3_snprintf(nMsg, zErrmsg, 
   495    510               "unable to open shared library [%s]", zFile);
   496    511           sqlite3OsDlError(pVfs, nMsg-1, zErrmsg);
   497    512         }
   498    513       }
   499    514       return SQLITE_ERROR;
   500    515     }
   501         -  xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*))
   502         -                   sqlite3OsDlSym(pVfs, handle, zEntry);
          516  +  xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);
   503    517   
   504    518     /* If no entry point was specified and the default legacy
   505    519     ** entry point name "sqlite3_extension_init" was not found, then
   506    520     ** construct an entry point name "sqlite3_X_init" where the X is
   507    521     ** replaced by the lowercase value of every ASCII alphabetic 
   508    522     ** character in the filename after the last "/" upto the first ".",
   509    523     ** and eliding the first three characters if they are "lib".  
................................................................................
   527    541       for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){
   528    542         if( sqlite3Isalpha(c) ){
   529    543           zAltEntry[iEntry++] = (char)sqlite3UpperToLower[(unsigned)c];
   530    544         }
   531    545       }
   532    546       memcpy(zAltEntry+iEntry, "_init", 6);
   533    547       zEntry = zAltEntry;
   534         -    xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*))
   535         -                     sqlite3OsDlSym(pVfs, handle, zEntry);
          548  +    xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);
   536    549     }
   537    550     if( xInit==0 ){
   538    551       if( pzErrMsg ){
   539    552         nMsg += sqlite3Strlen30(zEntry);
   540    553         *pzErrMsg = zErrmsg = sqlite3_malloc64(nMsg);
   541    554         if( zErrmsg ){
   542    555           sqlite3_snprintf(nMsg, zErrmsg,
................................................................................
   658    671   #endif
   659    672   
   660    673   
   661    674   /*
   662    675   ** Register a statically linked extension that is automatically
   663    676   ** loaded by every new database connection.
   664    677   */
   665         -int sqlite3_auto_extension(void (*xInit)(void)){
          678  +int sqlite3_auto_extension(
          679  +  void (*xInit)(sqlite3 *, char **, const void *) /* Extension entry point */
          680  +){
   666    681     int rc = SQLITE_OK;
   667    682   #ifndef SQLITE_OMIT_AUTOINIT
   668    683     rc = sqlite3_initialize();
   669    684     if( rc ){
   670    685       return rc;
   671    686     }else
   672    687   #endif
................................................................................
   674    689       u32 i;
   675    690   #if SQLITE_THREADSAFE
   676    691       sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
   677    692   #endif
   678    693       wsdAutoextInit;
   679    694       sqlite3_mutex_enter(mutex);
   680    695       for(i=0; i<wsdAutoext.nExt; i++){
   681         -      if( wsdAutoext.aExt[i]==xInit ) break;
          696  +      if( wsdAutoext.aExt[i]==(void*)xInit ) break;
   682    697       }
   683    698       if( i==wsdAutoext.nExt ){
   684    699         u64 nByte = (wsdAutoext.nExt+1)*sizeof(wsdAutoext.aExt[0]);
   685    700         void (**aNew)(void);
   686    701         aNew = sqlite3_realloc64(wsdAutoext.aExt, nByte);
   687    702         if( aNew==0 ){
   688    703           rc = SQLITE_NOMEM_BKPT;
   689    704         }else{
   690    705           wsdAutoext.aExt = aNew;
   691         -        wsdAutoext.aExt[wsdAutoext.nExt] = xInit;
          706  +        wsdAutoext.aExt[wsdAutoext.nExt] = (void*)xInit;
   692    707           wsdAutoext.nExt++;
   693    708         }
   694    709       }
   695    710       sqlite3_mutex_leave(mutex);
   696    711       assert( (rc&0xff)==rc );
   697    712       return rc;
   698    713     }
................................................................................
   703    718   ** set of routines that is invoked for each new database connection, if it
   704    719   ** is currently on the list.  If xInit is not on the list, then this
   705    720   ** routine is a no-op.
   706    721   **
   707    722   ** Return 1 if xInit was found on the list and removed.  Return 0 if xInit
   708    723   ** was not on the list.
   709    724   */
   710         -int sqlite3_cancel_auto_extension(void (*xInit)(void)){
          725  +int sqlite3_cancel_auto_extension(
          726  +  void (*xInit)(sqlite3 *, char **, const void *) /* Extension entry point */
          727  +){
   711    728   #if SQLITE_THREADSAFE
   712    729     sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
   713    730   #endif
   714    731     int i;
   715    732     int n = 0;
   716    733     wsdAutoextInit;
   717    734     sqlite3_mutex_enter(mutex);
   718    735     for(i=(int)wsdAutoext.nExt-1; i>=0; i--){
   719         -    if( wsdAutoext.aExt[i]==xInit ){
          736  +    if( wsdAutoext.aExt[i]==(void*)xInit ){
   720    737         wsdAutoext.nExt--;
   721    738         wsdAutoext.aExt[i] = wsdAutoext.aExt[wsdAutoext.nExt];
   722    739         n++;
   723    740         break;
   724    741       }
   725    742     }
   726    743     sqlite3_mutex_leave(mutex);
................................................................................
   752    769   **
   753    770   ** If anything goes wrong, set an error in the database connection.
   754    771   */
   755    772   void sqlite3AutoLoadExtensions(sqlite3 *db){
   756    773     u32 i;
   757    774     int go = 1;
   758    775     int rc;
   759         -  int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*);
          776  +  sqlite3_loadext_entry xInit;
   760    777   
   761    778     wsdAutoextInit;
   762    779     if( wsdAutoext.nExt==0 ){
   763    780       /* Common case: early out without every having to acquire a mutex */
   764    781       return;
   765    782     }
   766    783     for(i=0; go; i++){
................................................................................
   769    786       sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
   770    787   #endif
   771    788       sqlite3_mutex_enter(mutex);
   772    789       if( i>=wsdAutoext.nExt ){
   773    790         xInit = 0;
   774    791         go = 0;
   775    792       }else{
   776         -      xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*))
   777         -              wsdAutoext.aExt[i];
          793  +      xInit = (sqlite3_loadext_entry)wsdAutoext.aExt[i];
   778    794       }
   779    795       sqlite3_mutex_leave(mutex);
   780    796       zErrmsg = 0;
   781    797       if( xInit && (rc = xInit(db, &zErrmsg, &sqlite3Apis))!=0 ){
   782    798         sqlite3ErrorWithMsg(db, rc,
   783    799               "automatic extension loading failed: %s", zErrmsg);
   784    800         go = 0;
   785    801       }
   786    802       sqlite3_free(zErrmsg);
   787    803     }
   788    804   }

Changes to src/sqlite.h.in.

  5703   5703   ** ^Calling sqlite3_auto_extension(X) with an entry point X that is already
  5704   5704   ** on the list of automatic extensions is a harmless no-op. ^No entry point
  5705   5705   ** will be called more than once for each database connection that is opened.
  5706   5706   **
  5707   5707   ** See also: [sqlite3_reset_auto_extension()]
  5708   5708   ** and [sqlite3_cancel_auto_extension()]
  5709   5709   */
  5710         -int sqlite3_auto_extension(void (*xEntryPoint)(void));
         5710  +int sqlite3_auto_extension(
         5711  +  void (*xEntryPoint)(sqlite3 *, char **, const void *)
         5712  +);
  5711   5713   
  5712   5714   /*
  5713   5715   ** CAPI3REF: Cancel Automatic Extension Loading
  5714   5716   **
  5715   5717   ** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
  5716   5718   ** initialization routine X that was registered using a prior call to
  5717   5719   ** [sqlite3_auto_extension(X)].  ^The [sqlite3_cancel_auto_extension(X)]
  5718   5720   ** routine returns 1 if initialization routine X was successfully 
  5719   5721   ** unregistered and it returns 0 if X was not on the list of initialization
  5720   5722   ** routines.
  5721   5723   */
  5722         -int sqlite3_cancel_auto_extension(void (*xEntryPoint)(void));
         5724  +int sqlite3_cancel_auto_extension(
         5725  +  void (*xEntryPoint)(sqlite3 *, char **, const void *)
         5726  +);
  5723   5727   
  5724   5728   /*
  5725   5729   ** CAPI3REF: Reset Automatic Extension Loading
  5726   5730   **
  5727   5731   ** ^This interface disables all automatic extensions previously
  5728   5732   ** registered using [sqlite3_auto_extension()].
  5729   5733   */

Changes to src/sqlite3ext.h.

   247    247     int (*stricmp)(const char*,const char*);
   248    248     int (*uri_boolean)(const char*,const char*,int);
   249    249     sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64);
   250    250     const char *(*uri_parameter)(const char*,const char*);
   251    251     char *(*vsnprintf)(int,char*,const char*,va_list);
   252    252     int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
   253    253     /* Version 3.8.7 and later */
   254         -  int (*auto_extension)(void(*)(void));
          254  +  int (*auto_extension)(void(*)(sqlite3*,char**,const void*));
   255    255     int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64,
   256    256                        void(*)(void*));
   257    257     int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,
   258    258                         void(*)(void*),unsigned char);
   259         -  int (*cancel_auto_extension)(void(*)(void));
          259  +  int (*cancel_auto_extension)(void(*)(sqlite3*,char**,const void*));
   260    260     int (*load_extension)(sqlite3*,const char*,const char*,char**);
   261    261     void *(*malloc64)(sqlite3_uint64);
   262    262     sqlite3_uint64 (*msize)(void*);
   263    263     void *(*realloc64)(void*,sqlite3_uint64);
   264    264     void (*reset_auto_extension)(void);
   265    265     void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64,
   266    266                           void(*)(void*));
................................................................................
   281    281     int (*db_cacheflush)(sqlite3*);
   282    282     /* Version 3.12.0 and later */
   283    283     int (*system_errno)(sqlite3*);
   284    284     /* Version 3.14.0 and later */
   285    285     int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);
   286    286     char *(*expanded_sql)(sqlite3_stmt*);
   287    287   };
          288  +
          289  +/*
          290  +** This is the function signature used for all extension entry points.  It
          291  +** is also defined in the file "loadext.c".
          292  +*/
          293  +typedef int (*sqlite3_loadext_entry)(
          294  +  sqlite3 *db,                       /* Handle to the database. */
          295  +  char **pzErrMsg,                   /* Used to set error string on failure. */
          296  +  const sqlite3_api_routines *pThunk /* Extension API function pointers. */
          297  +);
   288    298   
   289    299   /*
   290    300   ** The following macros redefine the API routines so that they are
   291    301   ** redirected through the global sqlite3_api structure.
   292    302   **
   293    303   ** This header file is also used by the loadext.c source file
   294    304   ** (part of the main SQLite library - not an extension) so that

Changes to src/tclsqlite.c.

  3802   3802     zDigest[j] = 0;
  3803   3803   }
  3804   3804   
  3805   3805   /*
  3806   3806   ** A TCL command for md5.  The argument is the text to be hashed.  The
  3807   3807   ** Result is the hash in base64.
  3808   3808   */
  3809         -static int md5_cmd(void*cd, Tcl_Interp *interp, int argc, const char **argv){
         3809  +static int SQLITE_TCLAPI md5_cmd(
         3810  +  void*cd,
         3811  +  Tcl_Interp *interp,
         3812  +  int argc,
         3813  +  const char **argv
         3814  +){
  3810   3815     MD5Context ctx;
  3811   3816     unsigned char digest[16];
  3812   3817     char zBuf[50];
  3813   3818     void (*converter)(unsigned char*, char*);
  3814   3819   
  3815   3820     if( argc!=2 ){
  3816   3821       Tcl_AppendResult(interp,"wrong # args: should be \"", argv[0],
................................................................................
  3826   3831     return TCL_OK;
  3827   3832   }
  3828   3833   
  3829   3834   /*
  3830   3835   ** A TCL command to take the md5 hash of a file.  The argument is the
  3831   3836   ** name of the file.
  3832   3837   */
  3833         -static int md5file_cmd(void*cd, Tcl_Interp*interp, int argc, const char **argv){
         3838  +static int SQLITE_TCLAPI md5file_cmd(
         3839  +  void*cd,
         3840  +  Tcl_Interp *interp,
         3841  +  int argc,
         3842  +  const char **argv
         3843  +){
  3834   3844     FILE *in;
  3835   3845     MD5Context ctx;
  3836   3846     void (*converter)(unsigned char*, char*);
  3837   3847     unsigned char digest[16];
  3838   3848     char zBuf[10240];
  3839   3849   
  3840   3850     if( argc!=2 ){
................................................................................
  3906   3916     unsigned char digest[16];
  3907   3917     char zBuf[33];
  3908   3918     p = sqlite3_aggregate_context(context, sizeof(*p));
  3909   3919     MD5Final(digest,p);
  3910   3920     MD5DigestToBase16(digest, zBuf);
  3911   3921     sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
  3912   3922   }
  3913         -int Md5_Register(sqlite3 *db){
         3923  +int Md5_Register(
         3924  +  sqlite3 *db,
         3925  +  char **pzErrMsg,
         3926  +  const void *pThunk
         3927  +){
  3914   3928     int rc = sqlite3_create_function(db, "md5sum", -1, SQLITE_UTF8, 0, 0,
  3915   3929                                    md5step, md5finalize);
  3916   3930     sqlite3_overload_function(db, "md5sum", -1);  /* To exercise this API */
  3917   3931     return rc;
  3918   3932   }
  3919   3933   #endif /* defined(SQLITE_TEST) */
  3920   3934   

Changes to src/test_autoext.c.

    96     96   */
    97     97   static int SQLITE_TCLAPI autoExtSqrObjCmd(
    98     98     void * clientData,
    99     99     Tcl_Interp *interp,
   100    100     int objc,
   101    101     Tcl_Obj *CONST objv[]
   102    102   ){
   103         -  int rc = sqlite3_auto_extension((void*)sqr_init);
          103  +  int rc = sqlite3_auto_extension(sqr_init);
   104    104     Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
   105    105     return SQLITE_OK;
   106    106   }
   107    107   
   108    108   /*
   109    109   ** tclcmd:   sqlite3_cancel_auto_extension_sqr
   110    110   **
................................................................................
   112    112   */
   113    113   static int SQLITE_TCLAPI cancelAutoExtSqrObjCmd(
   114    114     void * clientData,
   115    115     Tcl_Interp *interp,
   116    116     int objc,
   117    117     Tcl_Obj *CONST objv[]
   118    118   ){
   119         -  int rc = sqlite3_cancel_auto_extension((void*)sqr_init);
          119  +  int rc = sqlite3_cancel_auto_extension(sqr_init);
   120    120     Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
   121    121     return SQLITE_OK;
   122    122   }
   123    123   
   124    124   /*
   125    125   ** tclcmd:   sqlite3_auto_extension_cube
   126    126   **
................................................................................
   128    128   */
   129    129   static int SQLITE_TCLAPI autoExtCubeObjCmd(
   130    130     void * clientData,
   131    131     Tcl_Interp *interp,
   132    132     int objc,
   133    133     Tcl_Obj *CONST objv[]
   134    134   ){
   135         -  int rc = sqlite3_auto_extension((void*)cube_init);
          135  +  int rc = sqlite3_auto_extension(cube_init);
   136    136     Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
   137    137     return SQLITE_OK;
   138    138   }
   139    139   
   140    140   /*
   141    141   ** tclcmd:   sqlite3_cancel_auto_extension_cube
   142    142   **
................................................................................
   144    144   */
   145    145   static int SQLITE_TCLAPI cancelAutoExtCubeObjCmd(
   146    146     void * clientData,
   147    147     Tcl_Interp *interp,
   148    148     int objc,
   149    149     Tcl_Obj *CONST objv[]
   150    150   ){
   151         -  int rc = sqlite3_cancel_auto_extension((void*)cube_init);
          151  +  int rc = sqlite3_cancel_auto_extension(cube_init);
   152    152     Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
   153    153     return SQLITE_OK;
   154    154   }
   155    155   
   156    156   /*
   157    157   ** tclcmd:   sqlite3_auto_extension_broken
   158    158   **
................................................................................
   160    160   */
   161    161   static int SQLITE_TCLAPI autoExtBrokenObjCmd(
   162    162     void * clientData,
   163    163     Tcl_Interp *interp,
   164    164     int objc,
   165    165     Tcl_Obj *CONST objv[]
   166    166   ){
   167         -  int rc = sqlite3_auto_extension((void*)broken_init);
          167  +  int rc = sqlite3_auto_extension(broken_init);
   168    168     Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
   169    169     return SQLITE_OK;
   170    170   }
   171    171   
   172    172   /*
   173    173   ** tclcmd:   sqlite3_cancel_auto_extension_broken
   174    174   **
................................................................................
   176    176   */
   177    177   static int SQLITE_TCLAPI cancelAutoExtBrokenObjCmd(
   178    178     void * clientData,
   179    179     Tcl_Interp *interp,
   180    180     int objc,
   181    181     Tcl_Obj *CONST objv[]
   182    182   ){
   183         -  int rc = sqlite3_cancel_auto_extension((void*)broken_init);
          183  +  int rc = sqlite3_cancel_auto_extension(broken_init);
   184    184     Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
   185    185     return SQLITE_OK;
   186    186   }
   187    187   
   188    188   #endif /* SQLITE_OMIT_LOAD_EXTENSION */
   189    189   
   190    190   

Changes to src/test_func.c.

   640    640     int argc,
   641    641     sqlite3_value **argv
   642    642   ){
   643    643     sqlite3_result_value(context, argv[0]);
   644    644     sqlite3_result_subtype(context, (unsigned int)sqlite3_value_int(argv[1]));
   645    645   }
   646    646   
   647         -static int registerTestFunctions(sqlite3 *db){
          647  +static int registerTestFunctions(
          648  +  sqlite3 *db,
          649  +  char **pzErrMsg,
          650  +  const void *pThunk
          651  +){
   648    652     static const struct {
   649    653        char *zName;
   650    654        signed char nArg;
   651    655        unsigned int eTextRep; /* 1: UTF-16.  0: UTF-8 */
   652    656        void (*xFunc)(sqlite3_context*,int,sqlite3_value **);
   653    657     } aFuncs[] = {
   654    658       { "randstr",               2, SQLITE_UTF8, randStr    },
................................................................................
   695    699   */
   696    700   static int SQLITE_TCLAPI autoinstall_test_funcs(
   697    701     void * clientData,
   698    702     Tcl_Interp *interp,
   699    703     int objc,
   700    704     Tcl_Obj *CONST objv[]
   701    705   ){
   702         -  extern int Md5_Register(sqlite3*);
   703         -  int rc = sqlite3_auto_extension((void*)registerTestFunctions);
          706  +  extern int Md5_Register(sqlite3 *, char **, const void *);
          707  +  int rc = sqlite3_auto_extension(registerTestFunctions);
   704    708     if( rc==SQLITE_OK ){
   705         -    rc = sqlite3_auto_extension((void*)Md5_Register);
          709  +    rc = sqlite3_auto_extension(Md5_Register);
   706    710     }
   707    711     Tcl_SetObjResult(interp, Tcl_NewIntObj(rc));
   708    712     return TCL_OK;
   709    713   }
   710    714   
   711    715   /*
   712    716   ** A bogus step function and finalizer function.
................................................................................
   795    799        char *zName;
   796    800        Tcl_ObjCmdProc *xProc;
   797    801     } aObjCmd[] = {
   798    802        { "autoinstall_test_functions",    autoinstall_test_funcs },
   799    803        { "abuse_create_function",         abuse_create_function  },
   800    804     };
   801    805     int i;
   802         -  extern int Md5_Register(sqlite3*);
          806  +  extern int Md5_Register(sqlite3 *, char **, const void *);
   803    807   
   804    808     for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
   805    809       Tcl_CreateObjCommand(interp, aObjCmd[i].zName, aObjCmd[i].xProc, 0, 0);
   806    810     }
   807    811     sqlite3_initialize();
   808         -  sqlite3_auto_extension((void*)registerTestFunctions);
   809         -  sqlite3_auto_extension((void*)Md5_Register);
          812  +  sqlite3_auto_extension(registerTestFunctions);
          813  +  sqlite3_auto_extension(Md5_Register);
   810    814     return TCL_OK;
   811    815   }

Changes to src/test_multiplex.c.

  1193   1193     gMultiplex.sIoMethodsV2.iVersion = 2;
  1194   1194     gMultiplex.sIoMethodsV2.xShmMap = multiplexShmMap;
  1195   1195     gMultiplex.sIoMethodsV2.xShmLock = multiplexShmLock;
  1196   1196     gMultiplex.sIoMethodsV2.xShmBarrier = multiplexShmBarrier;
  1197   1197     gMultiplex.sIoMethodsV2.xShmUnmap = multiplexShmUnmap;
  1198   1198     sqlite3_vfs_register(&gMultiplex.sThisVfs, makeDefault);
  1199   1199   
  1200         -  sqlite3_auto_extension((void*)multiplexFuncInit);
         1200  +  sqlite3_auto_extension(multiplexFuncInit);
  1201   1201   
  1202   1202     return SQLITE_OK;
  1203   1203   }
  1204   1204   
  1205   1205   /*
  1206   1206   ** CAPI: Shutdown the multiplex system - sqlite3_multiplex_shutdown()
  1207   1207   **

Changes to src/test_thread.c.

   276    276     Tcl_Obj *CONST objv[]
   277    277   ){
   278    278     int sqlite3TestMakePointerStr(Tcl_Interp *interp, char *zPtr, void *p);
   279    279   
   280    280     const char *zFilename;
   281    281     sqlite3 *db;
   282    282     char zBuf[100];
   283         -  extern void Md5_Register(sqlite3*);
          283  +  extern int Md5_Register(sqlite3 *, char **, const void *);
   284    284   
   285    285     UNUSED_PARAMETER(clientData);
   286    286     UNUSED_PARAMETER(objc);
   287    287   
   288    288     zFilename = Tcl_GetString(objv[2]);
   289    289     sqlite3_open(zFilename, &db);
   290    290   #ifdef SQLITE_HAS_CODEC
................................................................................
   299    299         sqlite3_close(db);
   300    300         Tcl_AppendResult(interp, zErrMsg, (char*)0);
   301    301         sqlite3_free(zErrMsg);
   302    302         return TCL_ERROR;
   303    303       }
   304    304     }
   305    305   #endif
   306         -  Md5_Register(db);
          306  +  Md5_Register(db, 0, 0);
   307    307     sqlite3_busy_handler(db, xBusy, 0);
   308    308     
   309    309     if( sqlite3TestMakePointerStr(interp, zBuf, db) ) return TCL_ERROR;
   310    310     Tcl_AppendResult(interp, zBuf, 0);
   311    311   
   312    312     return TCL_OK;
   313    313   }