In sqlite’s source code, you can see following define:
/*
** Add the ability to override 'extern'
*/
#ifndef SQLITE_EXTERN
# define SQLITE_EXTERN extern
#endif
I am not quite sure in what case we might want to override “extern”, do you have any idea?
We are telling the compiler to replace all instances of SQLITE_EXTERN with the “extern” keyword, when it preprocesses files. Hence if you includes a sql header which contains a declaration as below
SQLITE_EXTERN datatype sql_variable;
the compiler treats it as an “extern” variable and doesn’t allocate memory for the variable.
EDIT:
To add to that, it is a convention to declare variables with “extern” in the header files and defining the variable in the cpp file. Defining variables in the header files without “extern” qualifier would allocate space for the variable wherever the header file is included!
Overriding the extern:
The #define above provides an ability for you to initialize sql variables as you like. See the link http://msdn.microsoft.com/en-us/library/w7wd1177(v=vs.71).aspx for more details about initializers. There is a statement in the article ->
If you somehow want to override the external declaration of an sql variable, and want to initialize it by yourself, you could just define
One reason to override this is because Sqlite is cross platform (really widely), some of the platform may not support extern keywords well, thus we need to flexibility to disable this.
and init the variables as you want them. Hope this helps!