SQLite Lesson windows create a dynamic library

Download Source Package two:
sqlite-dll-win32-x86-3081101.zip, which provides the export function of sqlite3 file sqlite3.def
mainly used to generate LIB file to determine the link using
sqlite-preprocessed-3081101.zip, provides source file, but delete shell.c and tclsqlite3.c file
 
1. Create a new win32 console program name sqlite3
 
2. select the generated DLL
 
3. extracting archive, copy the sqlite-preprocessed-3081101 files to the project folder (except shell.c and tclsqlite.c).
 
4. By adding the file exists, the program source code to the compiler in
 
 
5 module definition file is provided sqlite3.def, otherwise generated without a corresponding dll lib
 
 
7. The add predefined options SQLITE_CORE, SQLITE_ENABLE_COLUMN_METADATA, SQLITE_ENABLE_RTREE, which is the sqlite3 macro definition.
 
8. F7 and generates a corresponding dll lib.
 
Compile small details:
 
the export file specified function: sqlite3.defs
Properties >> Linker >> Input >> module definition file (sqlite3.def), please note that in this case, sqlite3.def file and build environment same level.
Consequences: not generate sqlite3.lib file
specified precompiled macros:
property >> C / C ++ >> preprocessor >>Pre-defined >>

SQLITE_CORE
SQLITE_ENABLE_COLUMN_METADATA
SQLITE_ENABLE_RTREE
compiler error message:
1> sqlite3.def: error LNK2001: unresolved external symbol sqlite3_column_database_name
1> sqlite3.def: error LNK2001: unresolved external symbol sqlite3_column_database_name16
1> sqlite3.def: error LNK2001: unresolved external symbols sqlite3_column_origin_name
1> sqlite3.def: error LNK2001: unresolved external symbol sqlite3_column_origin_name16
1> sqlite3.def: error LNK2001: unresolved external symbol sqlite3_column_table_name
1> sqlite3.def: error LNK2001: unresolved external symbol sqlite3_column_table_name16
1> sqlite3 .def: error LNK2001: unresolved external symbol sqlite3_rtree_geometry_callback
1> sqlite3.def: error LNK2001: unresolved external symbol sqlite3_rtree_query_callback
front of six functions, you must define the SQLITE_ENABLE_COLUMN_METADATA be able to function to export, under normal circumstances, these functions, we sqlite3.def can delete the file, do not export
Behind the two functions, you must define the SQLITE_ENABLE_RTREE be able to export a function, if we do not apply the R-tree spatial search functions, these functions, we can delete the file directly in the sqlite3.def, do not export

Guess you like

Origin blog.51cto.com/fengyuzaitu/2430046