Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / July 2006

Tip: Looking for answers? Try searching our database.

Linkage Issue in VC7 (2003) with VC6 Libraries

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jim.massengale@eaglepoint.com - 07 Jul 2006 16:49 GMT
The Libraries that I am linking with are compiled in Visual 6.0. I have
an exported CEPAttribute with the function
CEPAttribute::GetLineStyle(CString &_strValue). The project that I am
compiling in VC7 (2003) uses the CEPAttribute but doesn't call the
::GetLineStyle(CString) function.

When it links I get the following error:

error LNK2001: unresolved external symbol "public: virtual int
__thiscall CEPAttribute::GetLineStyle(class ATL::CStringT<char,class
StrTraitMFC_DLL<char,class ATL::ChTraitsCRT<char> > > &)const "
(?GetLineStyle@CEPAttribute@@UBEHAAV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z)

Any ideas what the work around would be?
Jim
Tamas Demjen - 07 Jul 2006 17:57 GMT
> When it links I get the following error:
>
> error LNK2001: unresolved external symbol "public: virtual int
> __thiscall CEPAttribute::GetLineStyle(class ATL::CStringT<char,class
> StrTraitMFC_DLL<char,class ATL::ChTraitsCRT<char> > > &)const "
> (?GetLineStyle@CEPAttribute@@UBEHAAV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z)

Typically C++ compiled modules are not binary compatible among different
compilers. There's nothing you can do about that, your compilers are not
compatible. If you plan to export C++ classes, you must ensure that all
DLLs and the EXE are compiled with the exact same version of the
compiler, using the same compiler settings.

> Any ideas what the work around would be?

1. Use the same compiler for all modules, and the dynamic version of the
RTL.
or
2. Export extern "C" functions with no C++ features in their argument list.
or
3. Make a very thin interface (abstract) class that's linked to both the
DLL and the EXE. Put the implementation (inheriting from the interface)
to the DLL, but only export 2 pure C functions that create and delete
your objects. Use virtual function calls to bind the interface to the
implementation. If done carefully, this can work across different
compilers. You must remember that the DLL and the EXE have their own
copy of C RTL (included their separate memory managers).
or
4. Use ActiveX/COM, which provides a portable (cross-compiler and
cross-language) interfacing solution.

Tom

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.