Name mangling problem in static library

This question was already asked (thank you, Alexiski) in another thread, but I decided to describe problem in detail.

There is third-party static library project compiled in VC++.NET 2003 and exporting some classes. When I am trying to use it in my Windows Forms.NET application (also VC++.NET 2003) linker give me an error:

LNK2001: unresolved external symbol "public: int __thiscall CRemoteModbus::openConnection(class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > >,unsigned short,unsigned long)" ( openConnection@CRemoteModbus@@$$FQAEHV $CStringT@DV $StrTraitMFC@DV $ChTraitsCRT@D@ATL@@@@@ATL@@GK@Z)

So, I can create instance of CRemoteModbus class and call others methods of this class, but I can`t use "openConnection" method. Using LIB and DUMPBIN I discovered - decorated name of openConnection method in static library is:

openConnection@CRemoteModbus@@QAEHV $CStringT@DV $StrTraitMFC@DV $ChTraitsCRT@D@ATL@@@@@ATL@@GK@Z

but linker try to find:

openConnection@CRemoteModbus@@$$FQAEHV $CStringT@DV $StrTraitMFC@DV $ChTraitsCRT@D@ATL@@@@@ATL@@GK@Z

The only difference is "$$F".

UNDNAME give me the same undecorated name for both of decorated:

public: int __thiscall CRemoteModbus::OpenConnection(class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > >,unsigned short,unsigned long)

Any ideas


Answer this question

Name mangling problem in static library

  • learning_dotnet

    Do you have a simple application to reproduce the issue Also, try using the linker switch /verbose that might help you understand where it is finding the other symbols.

    Thanks,
    Ayman Shoukry
    VC++ Team


  • Jack Shoeman

    The $$F is added for the decorated name for managed entry points of methods. Undecorating the name will be the same in this case.

    Thanks,
    Ayman Shoukry
    VC++ Team


  • D_B

    It is interesting! Why all others methods of this class linked normal

    If the static library was made with no use of managed extensions, how to tell linker look for decorated names without $$F


  • ghostek

    Advised switch was very helpful. Thank you, Ayman Shoukry!
  • Name mangling problem in static library