Marc-Andre Michel
2004-02-16 16:24:32 UTC
Hi,
The application I'm working on uses only portable libs like ACE, stl,
etc... but must use a 3rd party DLL which has a function of this kind:
bool MyFunction(CString s);
Basically CString is part of MFC, so I built a DLL with an stl
interface which wraps the other, so my main application doesn't have
to link with MFC.
The corresponding wrapper looks like:
bool MyWrapperFunction(std::string s) {
return MyFunction(s.c_str());
}
The compilation of my wrapper DLL is fine, but I have an error when
linking:
error LNK2001: unresolved external symbol "__declspec(dllimport) bool
__cdecl MyFunction(class CString)"
(__imp_?MyFunction@@YA_NVCString@@@Z)
If I check the 3rd part DLL with for example DEPENDS.EXE, I can see
the function signature is a bit different:
?MyFunction@@YA_NV?$***@DV?$***@DV?$***@D@ATL@@@ATL@@@ATL@@@Z
It seems the 3rd party DLL was compiled with CString derived from ATL,
while I'm using CString from MFC. (?) In addition, the 3rd party DLL
was compiled with Visual Studio 7 and I'm using VS6.
Does anybody has experienced a similar situation ? How do I have to
set my DLL in order to link and call MyFunction ?
many thanks
Marc-Andre Michel
The application I'm working on uses only portable libs like ACE, stl,
etc... but must use a 3rd party DLL which has a function of this kind:
bool MyFunction(CString s);
Basically CString is part of MFC, so I built a DLL with an stl
interface which wraps the other, so my main application doesn't have
to link with MFC.
The corresponding wrapper looks like:
bool MyWrapperFunction(std::string s) {
return MyFunction(s.c_str());
}
The compilation of my wrapper DLL is fine, but I have an error when
linking:
error LNK2001: unresolved external symbol "__declspec(dllimport) bool
__cdecl MyFunction(class CString)"
(__imp_?MyFunction@@YA_NVCString@@@Z)
If I check the 3rd part DLL with for example DEPENDS.EXE, I can see
the function signature is a bit different:
?MyFunction@@YA_NV?$***@DV?$***@DV?$***@D@ATL@@@ATL@@@ATL@@@Z
It seems the 3rd party DLL was compiled with CString derived from ATL,
while I'm using CString from MFC. (?) In addition, the 3rd party DLL
was compiled with Visual Studio 7 and I'm using VS6.
Does anybody has experienced a similar situation ? How do I have to
set my DLL in order to link and call MyFunction ?
many thanks
Marc-Andre Michel