Small. Fast. Reliable.
Choose any three.
*** 20,42 ****
  <p>
  The filename is the name of the shared library or DLL.  The entrypoint
  is the name of an initialization function within the shared library.
! If the entry point is omitted, a suitable entry point name is constructed
! from the filename using the following rules:
! <p>
! <ul>
! <li>Convert the name to lower case
! <li>Remove the path prefix from the name
! <li>Remove the first "." and all following characters from the name
! <li>If the name begins with "lib" remove the first 3 characters
! <li>Remove all characters that are not US-ASCII alphanumerics
! or underscores
! <li>Remove any leading digits and underscores from the name
! <li>Append "_init" to the name
! </ul>
  <p>
  The entry point must be a function with the following prototype:
  <blockquote><pre>
! int EntryPoint(
    sqlite3 *db,          /* The database connection */
    char **pzErrMsg,      /* Write error messages here */
    const sqlite3_api_routines *pApi  /* API methods */
--- 20,32 ----
  <p>
  The filename is the name of the shared library or DLL.  The entrypoint
  is the name of an initialization function within the shared library.
! If the entry point is omitted then a default entry point function
! named <b>sqlite3_extension_init</b> is called.  Use of the default
! entry point name is recommended.
  <p>
  The entry point must be a function with the following prototype:
  <blockquote><pre>
! int sqlite3_extension_init(
    sqlite3 *db,          /* The database connection */
    char **pzErrMsg,      /* Write error messages here */
    const sqlite3_api_routines *pApi  /* API methods */
***************
*** 48,55 ****
  to routines like
  <a href="/capi3ref.html#sqlite3_create_function">sqlite3_create_function()</a>
  and
! <a href="/capi3ref.html#sqlite3_create_collation">sqlite3_create_collation()
! </a>
  If an error occurs and pzErrMsg is not NULL, then the extension
  should use <a href="/capi3ref.html#sqlite3_mprintf">sqlite3_mprintf()</a>
  to generate an error message and store that message at *pzErrMsg.
--- 38,44 ----
  to routines like
  <a href="/capi3ref.html#sqlite3_create_function">sqlite3_create_function()</a>
  and
! <a href="/capi3ref.html#sqlite3_create_collation">sqlite3_create_collation()</a>.
  If an error occurs and pzErrMsg is not NULL, then the extension
  should use <a href="/capi3ref.html#sqlite3_mprintf">sqlite3_mprintf()</a>
  to generate an error message and store that message at *pzErrMsg.
***************
*** 63,69 ****
  #include <sqlite3ext.h>
  SQLITE_EXTENSION_INIT1
  </font><font color="#202090">
- 
  /*
  ** The half() SQL function returns half of its input value.
  */
--- 52,57 ----
***************
*** 75,93 ****
    sqlite3_result_double(context, 0.5*sqlite3_value_double(argv[0]));
  }
  </font><font color="#008000">
! int demo2_init(sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi){
    SQLITE_EXTENSION_INIT2(pApi)</font><font color="#202090">
    sqlite3_create_function(db, "half", 1, SQLITE_ANY, 0, halfFunc, 0, 0);</font><font color="#008000">
    return 0;
  }</font>
  </pre></blockquote>
  <p> In the example above, the green text is boiler-plate that should
! appear in every loadable extension (except that you may want to change
! the name of the initialization function to something other than "demo2".)
! The blue text is stuff you enter.  In the example, a single SQL function
! that does nothing but multiply its input by 0.5 is shown.  A real
! loadable extension would probably do something more useful.
! </p>
  
  <p>Note that the extension uses the header file "sqlite3ext.h"
  instead of "sqlite3.h".  This is an imporant difference.  Dynamically
--- 63,95 ----
    sqlite3_result_double(context, 0.5*sqlite3_value_double(argv[0]));
  }
  </font><font color="#008000">
! /* SQLite invokes this routine once when it loads the extension.
! ** Create new functions, collating sequences, and virtual table
! ** modules here.  This is usually the only exported symbol in
! ** the shared library.
! */
! int sqlite3_extension_init(
!   sqlite3 *db,
!   char **pzErrMsg,
!   const sqlite3_api_routines *pApi
! ){
    SQLITE_EXTENSION_INIT2(pApi)</font><font color="#202090">
    sqlite3_create_function(db, "half", 1, SQLITE_ANY, 0, halfFunc, 0, 0);</font><font color="#008000">
    return 0;
  }</font>
  </pre></blockquote>
+ 
  <p> In the example above, the green text is boiler-plate that should
! appear in every loadable extension.
! The blue text is code you add to implement your extension.
! In the example, a single SQL function
! that multiplies its input by 0.5 is shown.  A real
! loadable extension would probably do something more useful.</p>
! 
! <p>A extension is not limited to creating a single function or
! collating sequence.  We expect that typically extensions will
! create multiple user functions, collating sequences, and/or virtual-table
! modules.</p>
  
  <p>Note that the extension uses the header file "sqlite3ext.h"
  instead of "sqlite3.h".  This is an imporant difference.  Dynamically