我正在嘗試編寫SQLite的包裝類,通過隱式鏈接通過DLL公開,即生成庫和頭文件供消費者編譯和鏈接。隱式DLL鏈接和類內部函數
目前我正在導出包裝類,但是當我嘗試編譯使用此包裝類的項目時,我收到了無法解析sqlite API調用的鏈接器錯誤,例如, sqlite3_open。包裝類和消費者都是C++,但是sqlite是C.
爲什麼消費者需要知道不暴露給它的函數(包裝類的整個點)?這是否意味着我需要修改SQLite頭以更改其函數,以便爲所有函數/我要封裝的函數提供適當的_declspec(dllexport)裝飾?這種改變是否有其他選擇?
的鏈接器錯誤:
libsqlite.lib(sqlitewrapper.oxl) : error LNK2019: unresolved external symbol _sq
lite3_close referenced in function "public: virtual __thiscall CSQLiteWrapper::~
CSQLiteWrapper(void)" ([email protected]@[email protected])
libsqlite.lib(sqlitewrapper.oxl) : error LNK2019: unresolved external symbol _sq
lite3_open referenced in function "public: __thiscall CSQLiteWrapper::CSQLiteWra
pper(class ATL::CStringT<char,class ATL::StrTraitATL<char,class ATL::ChTraitsCRT
<char> > > const &)" ([email protected]@[email protected][email protected][email protected]?$C
[email protected]@[email protected]@@[email protected]@@[email protected]@@Z)
libsqlite.lib(sqlitewrapper.oxl) : error LNK2019: unresolved external symbol _sq
lite3_free referenced in function "public: virtual void __thiscall CSQLiteWrappe
r::Exec(class ATL::CStringT<char,class ATL::StrTraitATL<char,class ATL::ChTraits
CRT<char> > > const &,int (__cdecl*)(void *,int,char * *,char * *))" ([email protected]
[email protected]@[email protected][email protected][email protected]@[email protected]@@[email protected]@@[email protected]
@[email protected]@Z)
libsqlite.lib(sqlitewrapper.oxl) : error LNK2019: unresolved external symbol _sq
lite3_exec referenced in function "public: virtual void __thiscall CSQLiteWrappe
r::Exec(class ATL::CStringT<char,class ATL::StrTraitATL<char,class ATL::ChTraits
CRT<char> > > const &,int (__cdecl*)(void *,int,char * *,char * *))" ([email protected]
[email protected]@[email protected][email protected][email protected]@[email protected]@@[email protected]@@[email protected]
@[email protected]@Z)
+1,這將是一個解決方案,但不是我正在尋找的解決方案,因爲它不會是隱式鏈接解決方案。 – dlanod