Debug version of LIB/DLL isn't linking with caller

G

Guest

Forgive me for re-posting this...in the first post, I replied to myself, and
the self-reply may having sounded like I found the problem, but it was
actually a correction.

-----------------

I have a very strange problem trying to link the debug version of my caller
application with one of my DLL's using .NET 2K5. The linker declares the
following error:

error LNK2001: unresolved external symbol
__imp_?MyExportedObject@@YAXW4MsgCategory@@PB_WK1@Z


When I perform a 'dumpbin' on the debug version of my DLL and its
corresponding LIB file, MyExportedObject has the following export signature
in both dumps:

?MyExportedObject@@YAXW4MsgCategory@@PBGK1@Z


However, the *release* version of my DLL and its LIB file having the
following signature:

?MyExportedObject@@YAXW4MsgCategory@@PB_WK1@Z

So, I can link the release version of my DLL to both the debug and the
release versions of my caller, but I have no such luck trying to link the
debug version of the DLL. This seems to only be a problem with the .NET 2K5
compiler; I wasn't having this problem with 2K3. It's as if the debug
version isn't using the lib file supplied to it or it's otherwise making a
determination about the symbols that's only compliant with the release
version of the dll. Any thoughts or suggestions would be greatly appreciated.

Thanks,

-Mike
 
W

William DePalo [MVP VC++]

mike2036 said:
I have a very strange problem trying to link the debug version of my
caller
application with one of my DLL's using .NET 2K5. The linker declares the
following error:

error LNK2001: unresolved external symbol
__imp_?MyExportedObject@@YAXW4MsgCategory@@PB_WK1@Z


When I perform a 'dumpbin' on the debug version of my DLL and its
corresponding LIB file, MyExportedObject has the following export
signature
in both dumps:

?MyExportedObject@@YAXW4MsgCategory@@PBGK1@Z


However, the *release* version of my DLL and its LIB file having the
following signature:

?MyExportedObject@@YAXW4MsgCategory@@PB_WK1@Z

So, I can link the release version of my DLL to both the debug and the

There is a little widget bundled with the compiler that can undecorate
names:

C:\>undname.exe ?MyExportedObject@@YAXW4MsgCategory@@PB_WK1@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation 1981-2001. All rights reserved.

Undecoration of :- "?MyExportedObject@@YAXW4MsgCategory@@PB_WK1@Z"
is :- "void __cdecl MyExportedObject(enum MsgCategory,wchar_t const
*,unsigned l
ong,wchar_t const *)"

C:\>undname ?MyExportedObject@@YAXW4MsgCategory@@PBGK1@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation 1981-2001. All rights reserved.

Undecoration of :- "?MyExportedObject@@YAXW4MsgCategory@@PBGK1@Z"
is :- "void __cdecl MyExportedObject(enum MsgCategory,unsigned short const
*,uns
igned long,unsigned short const *)"

So, I suggest you check your project's settings. It may be that the "Treat
wchar_t as built-in type" option is different between builds.

Regards,
Will
 
G

Guest

Thanks William. That was it.

-Mike


William DePalo said:
There is a little widget bundled with the compiler that can undecorate
names:

C:\>undname.exe ?MyExportedObject@@YAXW4MsgCategory@@PB_WK1@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation 1981-2001. All rights reserved.

Undecoration of :- "?MyExportedObject@@YAXW4MsgCategory@@PB_WK1@Z"
is :- "void __cdecl MyExportedObject(enum MsgCategory,wchar_t const
*,unsigned l
ong,wchar_t const *)"

C:\>undname ?MyExportedObject@@YAXW4MsgCategory@@PBGK1@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation 1981-2001. All rights reserved.

Undecoration of :- "?MyExportedObject@@YAXW4MsgCategory@@PBGK1@Z"
is :- "void __cdecl MyExportedObject(enum MsgCategory,unsigned short const
*,uns
igned long,unsigned short const *)"

So, I suggest you check your project's settings. It may be that the "Treat
wchar_t as built-in type" option is different between builds.

Regards,
Will
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top