/ Changes On Branch extRefactor
Login

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

Changes In Branch extRefactor Excluding Merge-Ins

This is equivalent to a diff from 91bc840eea to f2ab874782

2013-07-09
12:36
Modify several extensions to use the new exported function naming. Fix some shared library compilation issues. (check-in: 1e39f85077 user: drh tags: trunk)
2013-07-05
10:46
Make a couple of implicit casts explicit to fix compiler warnings. (check-in: 9676280a93 user: dan tags: trunk)
2013-07-04
23:53
Modify several extensions to use the new exported function naming. Fix some shared library compilation issues. (Closed-Leaf check-in: f2ab874782 user: mistachkin tags: extRefactor)
2013-07-02
15:25
Remove a surplus local variable (check-in: 91bc840eea user: drh tags: trunk)
10:06
Fix a minor typo in a comment in where.c. (check-in: 4a9d51e792 user: dan tags: trunk)

Changes to ext/fts1/fts1.c.

  3331   3331   int sqlite3Fts1Init(sqlite3 *db){
  3332   3332     sqlite3_overload_function(db, "snippet", -1);
  3333   3333     sqlite3_overload_function(db, "offsets", -1);
  3334   3334     return sqlite3_create_module(db, "fts1", &fulltextModule, 0);
  3335   3335   }
  3336   3336   
  3337   3337   #if !SQLITE_CORE
  3338         -int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg,
  3339         -                           const sqlite3_api_routines *pApi){
         3338  +#ifdef _WIN32
         3339  +__declspec(dllexport)
         3340  +#endif
         3341  +int sqlite3_fts1_init(sqlite3 *db, char **pzErrMsg,
         3342  +                      const sqlite3_api_routines *pApi){
  3340   3343     SQLITE_EXTENSION_INIT2(pApi)
  3341   3344     return sqlite3Fts1Init(db);
  3342   3345   }
  3343   3346   #endif
  3344   3347   
  3345   3348   #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1) */

Changes to ext/fts1/fulltext.c.

   848    848   /* Current interface:
   849    849   ** argv[0] - module name
   850    850   ** argv[1] - database name
   851    851   ** argv[2] - table name
   852    852   ** argv[3] - tokenizer name (optional, a sensible default is provided)
   853    853   ** argv[4..] - passed to tokenizer (optional based on tokenizer)
   854    854   **/
   855         -static int fulltextConnect(sqlite3 *db, void *pAux, int argc, char **argv,
   856         -                           sqlite3_vtab **ppVTab){
          855  +static int fulltextConnect(
          856  +  sqlite3 *db,
          857  +  void *pAux,
          858  +  int argc,
          859  +  const char * const *argv,
          860  +  sqlite3_vtab **ppVTab,
          861  +  char **pzErr
          862  +){
   857    863     int rc;
   858    864     fulltext_vtab *v;
   859    865     sqlite3_tokenizer_module *m = NULL;
   860    866   
   861    867     assert( argc>=3 );
   862    868     v = (fulltext_vtab *) malloc(sizeof(fulltext_vtab));
   863    869     /* sqlite will initialize v->base */
................................................................................
   894    900   
   895    901     memset(v->pFulltextStatements, 0, sizeof(v->pFulltextStatements));
   896    902   
   897    903     *ppVTab = &v->base;
   898    904     return SQLITE_OK;
   899    905   }
   900    906   
   901         -static int fulltextCreate(sqlite3 *db, void *pAux, int argc, char **argv,
   902         -                          sqlite3_vtab **ppVTab){
          907  +static int fulltextCreate(
          908  +  sqlite3 *db,
          909  +  void *pAux,
          910  +  int argc,
          911  +  const char * const *argv,
          912  +  sqlite3_vtab **ppVTab,
          913  +  char **pzErr
          914  +){
   903    915     int rc;
   904    916     assert( argc>=3 );
   905    917   
   906    918     /* The %_content table holds the text of each full-text item, with
   907    919     ** the rowid used as the docid.
   908    920     **
   909    921     ** The %_term table maps each term to a document list blob
................................................................................
   930    942     */
   931    943     rc = sql_exec(db, argv[2],
   932    944       "create table %_content(content text);"
   933    945       "create table %_term(term text, first integer, doclist blob);"
   934    946       "create index %_index on %_term(term, first)");
   935    947     if( rc!=SQLITE_OK ) return rc;
   936    948   
   937         -  return fulltextConnect(db, pAux, argc, argv, ppVTab);
          949  +  return fulltextConnect(db, pAux, argc, argv, ppVTab, pzErr);
   938    950   }
   939    951   
   940    952   /* Decide how to handle an SQL query.
   941    953    * At the moment, MATCH queries can include implicit boolean ANDs; we
   942    954    * haven't implemented phrase searches or OR yet. */
   943    955   static int fulltextBestIndex(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){
   944    956     int i;
................................................................................
  1484   1496   };
  1485   1497   
  1486   1498   int fulltext_init(sqlite3 *db){
  1487   1499    return sqlite3_create_module(db, "fulltext", &fulltextModule, 0);
  1488   1500   }
  1489   1501   
  1490   1502   #if !SQLITE_CORE
  1491         -int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg,
  1492         -                           const sqlite3_api_routines *pApi){
         1503  +#ifdef _WIN32
         1504  +__declspec(dllexport)
         1505  +#endif
         1506  +int sqlite3_fulltext_init(sqlite3 *db, char **pzErrMsg,
         1507  +                          const sqlite3_api_routines *pApi){
  1493   1508    SQLITE_EXTENSION_INIT2(pApi)
  1494   1509    return fulltext_init(db);
  1495   1510   }
  1496   1511   #endif

Changes to ext/fts2/fts2.c.

  6840   6840       sqlite3Fts2HashClear(pHash);
  6841   6841       sqlite3_free(pHash);
  6842   6842     }
  6843   6843     return rc;
  6844   6844   }
  6845   6845   
  6846   6846   #if !SQLITE_CORE
  6847         -int sqlite3_extension_init(
         6847  +#ifdef _WIN32
         6848  +__declspec(dllexport)
         6849  +#endif
         6850  +int sqlite3_fts2_init(
  6848   6851     sqlite3 *db, 
  6849   6852     char **pzErrMsg,
  6850   6853     const sqlite3_api_routines *pApi
  6851   6854   ){
  6852   6855     SQLITE_EXTENSION_INIT2(pApi)
  6853   6856     return sqlite3Fts2Init(db);
  6854   6857   }
  6855   6858   #endif
  6856   6859   
  6857   6860   #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) */

Changes to ext/fts2/fts2_hash.c.

    26     26   #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)
    27     27   
    28     28   #include <assert.h>
    29     29   #include <stdlib.h>
    30     30   #include <string.h>
    31     31   
    32     32   #include "sqlite3.h"
           33  +#include "sqlite3ext.h"
           34  +SQLITE_EXTENSION_INIT3
    33     35   #include "fts2_hash.h"
    34     36   
    35     37   /*
    36     38   ** Malloc and Free functions
    37     39   */
    38     40   static void *fts2HashMalloc(int n){
    39     41     void *p = sqlite3_malloc(n);

Changes to ext/fts2/fts2_porter.c.

    26     26   
    27     27   
    28     28   #include <assert.h>
    29     29   #include <stdlib.h>
    30     30   #include <stdio.h>
    31     31   #include <string.h>
    32     32   
           33  +#include "sqlite3.h"
           34  +#include "sqlite3ext.h"
           35  +SQLITE_EXTENSION_INIT3
    33     36   #include "fts2_tokenizer.h"
    34     37   
    35     38   /*
    36     39   ** Class derived from sqlite3_tokenizer
    37     40   */
    38     41   typedef struct porter_tokenizer {
    39     42     sqlite3_tokenizer base;      /* Base class */

Changes to ext/fts2/fts2_tokenizer.c.

    24     24   **       SQLite (in which case SQLITE_ENABLE_FTS2 is defined).
    25     25   */
    26     26   #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)
    27     27   
    28     28   
    29     29   #include "sqlite3.h"
    30     30   #include "sqlite3ext.h"
    31         -SQLITE_EXTENSION_INIT1
           31  +SQLITE_EXTENSION_INIT3
    32     32   
    33     33   #include "fts2_hash.h"
    34     34   #include "fts2_tokenizer.h"
    35     35   #include <assert.h>
    36     36   
    37     37   /*
    38     38   ** Implementation of the SQL scalar function for accessing the underlying 

Changes to ext/fts2/fts2_tokenizer1.c.

    26     26   
    27     27   
    28     28   #include <assert.h>
    29     29   #include <stdlib.h>
    30     30   #include <stdio.h>
    31     31   #include <string.h>
    32     32   
           33  +#include "sqlite3.h"
           34  +#include "sqlite3ext.h"
           35  +SQLITE_EXTENSION_INIT3
    33     36   #include "fts2_tokenizer.h"
    34     37   
    35     38   typedef struct simple_tokenizer {
    36     39     sqlite3_tokenizer base;
    37     40     char delim[128];             /* flag ASCII delimiters */
    38     41   } simple_tokenizer;
    39     42   

Changes to ext/fts3/fts3.c.

  5372   5372   }
  5373   5373   #endif
  5374   5374   
  5375   5375   #if !SQLITE_CORE
  5376   5376   /*
  5377   5377   ** Initialize API pointer table, if required.
  5378   5378   */
  5379         -int sqlite3_extension_init(
         5379  +#ifdef _WIN32
         5380  +__declspec(dllexport)
         5381  +#endif
         5382  +int sqlite3_fts3_init(
  5380   5383     sqlite3 *db, 
  5381   5384     char **pzErrMsg,
  5382   5385     const sqlite3_api_routines *pApi
  5383   5386   ){
  5384   5387     SQLITE_EXTENSION_INIT2(pApi)
  5385   5388     return sqlite3Fts3Init(db);
  5386   5389   }
  5387   5390   #endif
  5388   5391   
  5389   5392   #endif

Changes to ext/fts3/fts3Int.h.

    28     28   #endif
    29     29   
    30     30   #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
    31     31   
    32     32   /* If not building as part of the core, include sqlite3ext.h. */
    33     33   #ifndef SQLITE_CORE
    34     34   # include "sqlite3ext.h" 
    35         -extern const sqlite3_api_routines *sqlite3_api;
           35  +SQLITE_EXTENSION_INIT3
    36     36   #endif
    37     37   
    38     38   #include "sqlite3.h"
    39     39   #include "fts3_tokenizer.h"
    40     40   #include "fts3_hash.h"
    41     41   
    42     42   /*

Changes to ext/icu/icu.c.

   484    484       );
   485    485     }
   486    486   
   487    487     return rc;
   488    488   }
   489    489   
   490    490   #if !SQLITE_CORE
   491         -int sqlite3_extension_init(
          491  +#ifdef _WIN32
          492  +__declspec(dllexport)
          493  +#endif
          494  +int sqlite3_icu_init(
   492    495     sqlite3 *db, 
   493    496     char **pzErrMsg,
   494    497     const sqlite3_api_routines *pApi
   495    498   ){
   496    499     SQLITE_EXTENSION_INIT2(pApi)
   497    500     return sqlite3IcuInit(db);
   498    501   }
   499    502   #endif
   500    503   
   501    504   #endif

Changes to ext/rtree/rtree.c.

  3346   3346     ** the context object when it is no longer required.  */
  3347   3347     return sqlite3_create_function_v2(db, zGeom, -1, SQLITE_ANY, 
  3348   3348         (void *)pGeomCtx, geomCallback, 0, 0, doSqlite3Free
  3349   3349     );
  3350   3350   }
  3351   3351   
  3352   3352   #if !SQLITE_CORE
  3353         -int sqlite3_extension_init(
         3353  +#ifdef _WIN32
         3354  +__declspec(dllexport)
         3355  +#endif
         3356  +int sqlite3_rtree_init(
  3354   3357     sqlite3 *db,
  3355   3358     char **pzErrMsg,
  3356   3359     const sqlite3_api_routines *pApi
  3357   3360   ){
  3358   3361     SQLITE_EXTENSION_INIT2(pApi)
  3359   3362     return sqlite3RtreeInit(db);
  3360   3363   }
  3361   3364   #endif
  3362   3365   
  3363   3366   #endif

Changes to mkextw.sh.

     7      7   OPTS='-DTHREADSAFE=1 -DBUILD_sqlite=1 -DSQLITE_OS_WIN=1'
     8      8   CC="i386-mingw32msvc-gcc -O2 $OPTS -Itsrc"
     9      9   NM="i386-mingw32msvc-nm"
    10     10   CMD="$CC -c fts2amal.c"
    11     11   echo $CMD
    12     12   $CMD
    13     13   echo 'EXPORTS' >fts2.def
    14         -echo 'sqlite3_extension_init' >>fts2.def
           14  +echo 'sqlite3_fts2_init' >>fts2.def
    15     15   i386-mingw32msvc-dllwrap \
    16     16        --def fts2.def -v --export-all \
    17     17        --driver-name i386-mingw32msvc-gcc \
    18     18        --dlltool-name i386-mingw32msvc-dlltool \
    19     19        --as i386-mingw32msvc-as \
    20     20        --target i386-mingw32 \
    21     21        -dllname fts2.dll -lmsvcrt fts2amal.o
    22     22   zip fts2dll.zip fts2.dll fts2.def

Changes to src/sqlite3ext.h.

   470    470   #endif /* SQLITE_CORE */
   471    471   
   472    472   #ifndef SQLITE_CORE
   473    473     /* This case when the file really is being compiled as a loadable 
   474    474     ** extension */
   475    475   # define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api=0;
   476    476   # define SQLITE_EXTENSION_INIT2(v)  sqlite3_api=v;
          477  +# define SQLITE_EXTENSION_INIT3     \
          478  +    extern const sqlite3_api_routines *sqlite3_api;
   477    479   #else
   478    480     /* This case when the file is being statically linked into the 
   479    481     ** application */
   480    482   # define SQLITE_EXTENSION_INIT1     /*no-op*/
   481    483   # define SQLITE_EXTENSION_INIT2(v)  (void)v; /* unused parameter */
          484  +# define SQLITE_EXTENSION_INIT3     /*no-op*/
   482    485   #endif
   483    486   
   484    487   #endif /* _SQLITE3EXT_H_ */

Changes to src/test_schema.c.

   340    340   }
   341    341   
   342    342   #else
   343    343   
   344    344   /*
   345    345   ** Extension load function.
   346    346   */
   347         -int sqlite3_extension_init(
          347  +#ifdef _WIN32
          348  +__declspec(dllexport)
          349  +#endif
          350  +int sqlite3_schema_init(
   348    351     sqlite3 *db, 
   349    352     char **pzErrMsg, 
   350    353     const sqlite3_api_routines *pApi
   351    354   ){
   352    355     SQLITE_EXTENSION_INIT2(pApi);
   353    356   #ifndef SQLITE_OMIT_VIRTUALTABLE
   354    357     sqlite3_create_module(db, "schema", &schemaModule, 0);
   355    358   #endif
   356    359     return 0;
   357    360   }
   358    361   
   359    362   #endif