SQLite

Check-in [86eb3eed4c]
Login

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

Overview
Comment:Make the SQLITE_EXTENSION_INIT1 and SQLITE_EXTENSION_INIT2 macros into no-ops if the extension is statically linked.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | loadext
Files: files | file ages | folders
SHA1: 86eb3eed4c70730dba0e319f243f8cb4fa8de06c
User & Date: drh 2013-04-19 01:23:06.788
Context
2013-04-19
02:47
Enhance the extension loading mechanism so that the same source code can be used for run-time loadable extensions and statically linked extensions, and to mask architectural differences in shared libraries. (check-in: a85b6ecefa user: drh tags: trunk)
01:23
Make the SQLITE_EXTENSION_INIT1 and SQLITE_EXTENSION_INIT2 macros into no-ops if the extension is statically linked. (Closed-Leaf check-in: 86eb3eed4c user: drh tags: loadext)
2013-04-18
22:56
Experiments in making loadable extensions easier to program. The shared library filename tries various operating-system specific extensions if the bare library name does not work. And the entry point is derived from the filename is the legacy entry point name "sqlite3_extension_init" is not found. (check-in: 6cfa1d73d7 user: drh tags: loadext)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/sqlite3ext.h.
465
466
467
468
469
470
471



472
473






474
475
#define sqlite3_uri_boolean            sqlite3_api->uri_boolean
#define sqlite3_uri_int64              sqlite3_api->uri_int64
#define sqlite3_uri_parameter          sqlite3_api->uri_parameter
#define sqlite3_uri_vsnprintf          sqlite3_api->vsnprintf
#define sqlite3_wal_checkpoint_v2      sqlite3_api->wal_checkpoint_v2
#endif /* SQLITE_CORE */




#define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api = 0;
#define SQLITE_EXTENSION_INIT2(v)  sqlite3_api = v;







#endif /* _SQLITE3EXT_H_ */







>
>
>
|
|
>
>
>
>
>
>


465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
#define sqlite3_uri_boolean            sqlite3_api->uri_boolean
#define sqlite3_uri_int64              sqlite3_api->uri_int64
#define sqlite3_uri_parameter          sqlite3_api->uri_parameter
#define sqlite3_uri_vsnprintf          sqlite3_api->vsnprintf
#define sqlite3_wal_checkpoint_v2      sqlite3_api->wal_checkpoint_v2
#endif /* SQLITE_CORE */

#ifndef SQLITE_CORE
  /* This case when the file really is being compiled as a loadable 
  ** extension */
# define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api=0;
# define SQLITE_EXTENSION_INIT2(v)  sqlite3_api=v;
#else
  /* This case when the file is being statically linked into the 
  ** application */
# define SQLITE_EXTENSION_INIT1     /*no-op*/
# define SQLITE_EXTENSION_INIT2(v)  (void)v; /* unused parameter */
#endif

#endif /* _SQLITE3EXT_H_ */
Changes to src/test_autoext.c.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
*************************************************************************
** Test extension for testing the sqlite3_auto_extension() function.
*/
#include "tcl.h"
#include "sqlite3ext.h"

#ifndef SQLITE_OMIT_LOAD_EXTENSION
static SQLITE_EXTENSION_INIT1

/*
** The sqr() SQL function returns the square of its input value.
*/
static void sqrFunc(
  sqlite3_context *context,
  int argc,







|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
*************************************************************************
** Test extension for testing the sqlite3_auto_extension() function.
*/
#include "tcl.h"
#include "sqlite3ext.h"

#ifndef SQLITE_OMIT_LOAD_EXTENSION
SQLITE_EXTENSION_INIT1

/*
** The sqr() SQL function returns the square of its input value.
*/
static void sqrFunc(
  sqlite3_context *context,
  int argc,