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++ / March 2006

Tip: Looking for answers? Try searching our database.

[newbie] C++ with managed extensions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Schmitz - 19 Mar 2006 11:14 GMT
Hi,

I created a C++ DLL in .net 1.1 that makes use of some .net features (so
called 'mixed' or hybrid DLL, as it contains both .net and 'old' C++ code).
The project worked and compiled fine with VS2003 - but now I had to upgrade
the whole lot to VS2005: Compiling and linking works still fine (with
/clr:OldSyntax), but suddenly other DLLs that should call functions in this
mixed DLL complain on linking (LNK2019: unresolved external symbol)....any
ideas why??

Thanks ,

Peter
Carl Daniel [VC++ MVP] - 19 Mar 2006 15:35 GMT
> Hi,
>
[quoted text clipped - 5 lines]
> call functions in this mixed DLL complain on linking (LNK2019:
> unresolved external symbol)....any ideas why??

If you give some examples of functions that are coming up undefined, it
would help.

One thought:  /Zc:wchar_t is on by default in VC 2005, off by default in VC
2003, so if you're exposing functions that deal in wide-character (Unicode)
strings, you might see this problem.  If that's the case, either re-compile
your DLL with /Zc:wchar_t- or rebuild the other DLLs with VC 2005 as well.

-cd
Peter Schmitz - 19 Mar 2006 16:47 GMT
Thanks for replying!

The functions that are coming up undefined are my own functions (CString
TestFunc(CString param)).

-Peter

> > Hi,
> >
[quoted text clipped - 15 lines]
>
> -cd
Carl Daniel [VC++ MVP] - 19 Mar 2006 17:13 GMT
> Thanks for replying!
>
> The functions that are coming up undefined are my own functions
> (CString TestFunc(CString param)).

Is it a Unicode build?  What are the other DLLs built with?

As a general rule, you can't pass MFC/ATL/STL objects between program
modules unless they're compiled with the same version of the same compiler.
There are undefined internals that change from version to version breaking
binary compatiblity.

If you need a version independent interface to a DLL, you have to stick to
plain old C (not C++) interfaces.

-cd
Peter Schmitz - 20 Mar 2006 19:27 GMT
All DLLs are compiled with VC8 - all of them are compiled with the 'multi
byte' option.

The strange thing is, that I can link to the DLL if  it's compiled/linked
with VS2003 - but breaks with VS2005. I've checked if the DLL exports the
correct functions - it does. So I'd guess, that the problem lies within the
lib file...

-Peter

> > Thanks for replying!
> >
[quoted text clipped - 12 lines]
>
> -cd

Rate this thread:







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.