xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_load_extension.3 (revision a24efa7dea9f1f56c3bdb15a927d3516792ace1c)
1.Dd $Mdocdate$
2.Dt SQLITE3_LOAD_EXTENSION 3
3.Os
4.Sh NAME
5.Nm sqlite3_load_extension
6.Nd Load An Extension
7.Sh SYNOPSIS
8.Ft int
9.Fo sqlite3_load_extension
10.Fa "sqlite3 *db"
11.Fa "const char *zFile"
12.Fa "const char *zProc"
13.Fa "char **pzErrMsg       "
14.Fc
15.Sh DESCRIPTION
16This interface loads an SQLite extension library from the named file.
17.Pp
18The sqlite3_load_extension() interface attempts to load an SQLite extension
19library contained in the file zFile.
20If the file cannot be loaded directly, attempts are made to load with
21various operating-system specific extensions added.
22So for example, if "samplelib" cannot be loaded, then names like "samplelib.so"
23or "samplelib.dylib" or "samplelib.dll" might be tried also.
24.Pp
25The entry point is zProc.
26zProc may be 0, in which case SQLite will try to come up with an entry
27point name on its own.
28It first tries "sqlite3_extension_init".
29If that does not work, it constructs a name "sqlite3_X_init" where
30the X is consists of the lower-case equivalent of all ASCII alphabetic
31characters in the filename from the last "/" to the first following
32"." and omitting any initial "lib".
33The sqlite3_load_extension() interface returns SQLITE_OK on
34success and SQLITE_ERROR if something goes wrong.
35If an error occurs and pzErrMsg is not 0, then the sqlite3_load_extension()
36interface shall attempt to fill *pzErrMsg with error message text stored
37in memory obtained from sqlite3_malloc().
38The calling function should free this memory by calling sqlite3_free().
39.Pp
40Extension loading must be enabled using sqlite3_enable_load_extension()
41prior to calling this API, otherwise an error will be returned.
42.Pp
43See also the load_extension() SQL function.
44.Sh SEE ALSO
45.Xr sqlite3_enable_load_extension 3 ,
46.Xr sqlite3_malloc 3 ,
47.Xr sqlite3_load_extension 3 ,
48.Xr sqlite3_malloc 3 ,
49.Xr SQLITE_OK 3
50