Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linking with a dll

Status
Not open for further replies.

joeGrammar

Programmer
Jun 4, 2001
162
CA
Hey dudes, could someone check out these unresolved symbols spawning from my dll. They are all exported, it seems to be name mangling, but each function has extern "C" in front of it. Can anyone make any suggestions, this is driving me looptyloo


03120101.obj : error LNK2001: unresolved external symbol &quot;bool __stdcall CreatePersistentCfgItem(char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,enum INDICATOR,char const *,bool)&quot; (?Create
PersistentCfgItem@@YG_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4INDICATOR@@0_N@Z)


03120101.obj : error LNK2001: unresolved external symbol &quot;__declspec(dllimport) public: bool __thiscall DbUpdateAppCommon::SetDBAPI(void *,int,bool (__stdcall*)(void *,int),bool (__stdcall*)(void *,int),bool (__stdcall*)(void))&quot; (__imp_?SetDBAPI@DbU
pdateAppCommon@@QAE_NPAXHP6G_N0H@Z1P6G_NXZ@Z)


03120101.obj : error LNK2001: unresolved external symbol __imp__atol_where@12

03120101.obj : error LNK2001: unresolved external symbol &quot;bool __stdcall GetCfgItemValue(char const *,int &,bool)&quot; (?GetCfgItemValue@@YG_NPBDAAH_N@Z)


03120101.obj : error LNK2001: unresolved external symbol &quot;__declspec(dllimport) bool __stdcall ValidateDate(char const *,int,bool,bool)&quot; (__imp_?ValidateDate@@YG_NPBDH_N1@Z)


03120101.obj : error LNK2001: unresolved external symbol &quot;bool __stdcall GetCfgItemValue(char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,bool)&quot; (?GetCfgItemValue@@YG_NPBDAAV?$basic_string@DU?$ch
ar_traits@D@std@@V?$allocator@D@2@@std@@_N@Z)


03120101.obj : error LNK2001: unresolved external symbol &quot;bool __stdcall GetCfgItemValue(char const *,double &,bool)&quot; (?GetCfgItemValue@@YG_NPBDAAN_N@Z)

03120101.obj : error LNK2001: unresolved external symbol &quot;__declspec(dllimport) public: void __thiscall DbUpdateAppCommon::SetupInputBuffer(struct str_RecRowId &)&quot; (__imp_?SetupInputBuffer@DbUpdateAppCommon@@QAEXAAUstr_RecRowId@@@Z)


03120101.obj : error LNK2001: unresolved external symbol __imp__GetAppName@0

03120101.obj : error LNK2001: unresolved external symbol &quot;__declspec(dllimport) long __stdcall GetNationalIOUId(void)&quot; (__imp_?GetNationalIOUId@@YGJXZ)

03120101.obj : error LNK2001: unresolved external symbol &quot;bool __stdcall SetCfgItemValue(char const *,long,bool)&quot; (?SetCfgItemValue@@YG_NPBDJ_N@Z)


03120101.obj : error LNK2001: unresolved external symbol _InsertPymntRqstn@4


03120101.obj : error LNK2001: unresolved external symbol _GetPyblUsingPymntId@24


03120101.obj : error LNK2001: unresolved external symbol &quot;bool __stdcall SetCfgItemValue(char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool)&quot; (?SetCfgItemValue@@YG_NPBDABV?$basic_string@
DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z)


03120101.obj : error LNK2001: unresolved external symbol &quot;bool __stdcall CheckPointCfgItem(char const *,bool)&quot; (?CheckPointCfgItem@@YG_NPBD_N@Z)


03120102.obj : error LNK2001: unresolved external symbol __imp__PassOrThrow@16

03120102.obj : error LNK2001: unresolved external symbol _sqlorat@12

03120102.obj : error LNK2001: unresolved external symbol _sqlcxt@16

03120102.obj : error LNK2001: unresolved external symbol __imp__PassOrThrowForFetch@16

03120102.obj : error LNK2001: unresolved external symbol _GetAppName@0

03120102.obj : error LNK2001: unresolved external symbol _DBUtl_Severe_Error@12

03120102.obj : error LNK2001: unresolved external symbol _DBUtl_GMTNow@4

03120102.obj : error LNK2001: unresolved external symbol __imp__GetFakeDbTime@4


 
Have you included the appropriate .lib files in the project and put the necessary dll's in the Debug/Release folders or in the System folder on the C drive?

Matt
 
how are you declaring one of them and how do you inplement it? I sure say you, it is not a problem with name mangling, C++ bugs, windows bugs, virusses or outside rains. John Fill
1c.bmp


ivfmd@mail.md
 
Yea, its just a console application making dll calls. Everything is included...

One interesting thing I discovered was my calling convention was __stdcall

Once I changed this to __cdecl my errors were cut in half
 
it doesn't have to do if is a console, atl, mfc or win32/win16api type application. One adive, put in you dll's .h only what you're using in dll and dllapi's. Everithing else put away from dll. John Fill
1c.bmp


ivfmd@mail.md
 
Oh well, through unscathed genius, I have managed to solve all my problems
 
one short questions, is it about name mangles? You can respond me by email. John Fill
1c.bmp


ivfmd@mail.md
 
Sorry, the names were being mangled until I changed the code generation part to __cdecl.

I didn't understand why the names were being mangled because I had extern &quot;C&quot; surrounding everything. Apparently __stdcall either doesn't recognize or acknowledge the extern &quot;C&quot; label. Give it a try and see
 
I had similar problems while using cpp dll in c programs. They require __cdecl. Also in COM prorgamming in interfaces you will have problems with calling convenstion because of proxy programs. They recognize only __stdcall.. Also basic programs preffer __stdcall. One other problem can be when you are using different type of compillers, for example gcc/g++, BorlandC++ with VisualC++. Everithing else have nothing to do with name mangling. To force calling convention for eliminating problems is a bad tone. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top