原文地址:http://blog.csdn.net/spche/archive/2010/06/10/5661580.aspx
網(wǎng)上大多數(shù)的使用vs2005編譯sqlite是編譯成為dll,我的目的是為了分析sqlite,所以還是編譯成一個(gè)可執(zhí)行程序方便單步調(diào)試
1.創(chuàng)建一個(gè)空的Win32 Console Application工程,
2.sqlite3.6.23的所有源碼均加入工程,除去以下幾個(gè)
mutex_os2.cmutex_unix.cos_os2.cos_unix.ctclsqlite.c
shell.c 可去可不去,不去的話,可生成執(zhí)行SQL的輸入控制吧,方便調(diào)試;去掉的話,需要自已編寫一個(gè)測試的C文件,
3.選擇合適的RuntimeLibrary,默認(rèn)為多線程模式。位置:Project->Properties->Configuration Properties->C/C++->Code Generation->Runtime Library,這個(gè)沒有改,就是默認(rèn)多線程的
4.將編譯模式改為c模式(TC)。位置:Project->Properties->Configuration Properties->C/C++->Advanced->Compile As。默認(rèn)的是C++的,這個(gè)需要改
5.如果想要取得不必要的警告信息,則作如下處理:
- 在預(yù)處理定義處加 NO_TCL _CRT_SECURE_NO_WARNINGS SQLITE_ENABLE_FTS3 SQLITE_ENABLE_FTS3_PARENTHESIS
SQLITE_ENABLE_RTREE位置: Project->Properties->Configuration Properties->C/C++->Preprocessor->Preprocessor Definitions
- disable 制定的警告信息(Project->Properties->C/C++->Advanced->Disable Specific Warnings): 4267;4244;4018;4311;4996;4312;4311
6.將fts3_tokenizer.c中27行的

/**//*
#include "sqlite3ext.h"
#ifndef SQLITE_CORE
//SQLITE_EXTENSION_INIT1
extern const sqlite3_api_routines *sqlite3_api;
#endif
*/

#include "fts3_tokenizer.h"


把rtree.c的2877行
/*
#if !SQLITE_CORE
int sqlite3_extension_init(
sqlite3 *db,
char **pzErrMsg,
const sqlite3_api_routines *pApi
){
SQLITE_EXTENSION_INIT2(pApi)
return sqlite3RtreeInit(db);
}
#endif
*/
56行改為
/*
#ifndef SQLITE_CORE
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#else
#include "sqlite3.h"
#endif
*/
#include "rtree.h"
外部引用有問題,估計(jì)功能不完善,先這么改
7.編譯,在shell.c中的main函數(shù)設(shè)斷點(diǎn)就可以單步執(zhí)行了
icu是internationalcomponents forunicode,如果需要?jiǎng)t需另外下載相關(guān)頭文件。這個(gè)網(wǎng)站上不去,所以沒加上去
源碼下載
posted on 2011-06-16 23:07
漂漂 閱讀(846)
評論(0) 編輯 收藏 引用 所屬分類:
數(shù)據(jù)庫