Automatically Load Statically Linked Extensions

Automatically Load Statically Linked Extensions

int sqlite3_auto_extension(void(*xEntryPoint)(void));

This interface causes the xEntryPoint() function to be invoked for each new database connection that is created. The idea here is that xEntryPoint() is the entry point for a statically linked SQLite extension that is to be automatically loaded into all new database connections.

Even though the function prototype shows that xEntryPoint() takes no arguments and returns void, SQLite invokes xEntryPoint() with three arguments and expects an integer result as if the signature of the entry point where as follows:

   int xEntryPoint(
     sqlite3 *db,
     const char **pzErrMsg,
     const struct sqlite3_api_routines *pThunk
   );

If the xEntryPoint routine encounters an error, it should make *pzErrMsg point to an approp