Name

sqlite3_auto_extension() — Register an automatic extension

Definition

int sqlite3_auto_extension( entry_point );

void entry_point( );
entry_point

A function pointer to an extension entry point.

Returns

An SQLite result code.

Description

This function registers an extension entry-point function. Once an entry point is registered, any database connection opened by the SQLite library will automatically call the entry point. Multiple entry points can be registered. It is safe to register the same entry point multiple times. In that case, the entry point will only be called once.

Although the entry point is given as void entry_point( ), the actual format of an entry-point function is:

int entry_point( sqlite3* db, char** error, const sqlite3_api_routines* api );

The discrepancy of the types will likely require a cast or redefinition of the entry-point function.

This function can only be used to register extensions with static entry points. Dynamically loaded extensions cannot be directly registered with this function. To clear the list of automatic extensions, call sqlite3_reset_auto_extension(). This should be done before calling sqlite3_shutdown().

For more information on extensions and entry points, see the section SQLite Extensions.

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.