Misc linker errors when moving to /clr

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ralphsieminsky@hotmail.com

    #1

    Misc linker errors when moving to /clr

    A project compiles fine under VS 2005 RC without the /clr
    option. However, when /clr is turned on several errors appear:

    - A symbol exported from a DLL is not found by another
    DLL referencing it.

    The name of the symbol present in the DLL, as shown by
    depends.exe is ?Apply@ScreenCo ntext@@SGPAV1@P AUHWND__@@@Z

    But the name of the symbol the linker looks for when
    it tries to build the DLL depending on it is
    ?Apply@ScreenCo ntext@@$$FSGPAV 1@PAUHWND__@@@Z

    Strangely enough, the two symbol have exactly the same
    undecorated name

    - The second error is the following
    mfcs80ud.lib(dl lmodul.obj) : error LNK2005: _DllMain@12 already defined
    in msvcrtd.lib(dll main.obj)


    seems to talk about it, but there is no way I could get
    to make its workarounds solve the problem (the instructions don't apply
    to VS2005). But why would it manifest itself only in /clr mode ?


    Any clue is much appreciated !

    Cheers,
    Ralph

  • bonk

    #2
    Re: Misc linker errors when moving to /clr

    I had a similar (maybe the same ?) issue but with VS 2005 Beta 2.
    It is described here:


    Now it also says there this bug is resolved in a later build after Beta
    2. Now I am quite shocked that this might not be the case since you are
    using VS 2005 RC. However it seems that I found a workaround wich I
    reported here:




    ralphsieminsky@ hotmail.com schrieb:[color=blue]
    > A project compiles fine under VS 2005 RC without the /clr
    > option. However, when /clr is turned on several errors appear:
    >
    > - A symbol exported from a DLL is not found by another
    > DLL referencing it.
    >
    > The name of the symbol present in the DLL, as shown by
    > depends.exe is ?Apply@ScreenCo ntext@@SGPAV1@P AUHWND__@@@Z
    >
    > But the name of the symbol the linker looks for when
    > it tries to build the DLL depending on it is
    > ?Apply@ScreenCo ntext@@$$FSGPAV 1@PAUHWND__@@@Z
    >
    > Strangely enough, the two symbol have exactly the same
    > undecorated name
    >
    > - The second error is the following
    > mfcs80ud.lib(dl lmodul.obj) : error LNK2005: _DllMain@12 already defined
    > in msvcrtd.lib(dll main.obj)
    >
    > http://support.microsoft.com/default...;en-us;q148652
    > seems to talk about it, but there is no way I could get
    > to make its workarounds solve the problem (the instructions don't apply
    > to VS2005). But why would it manifest itself only in /clr mode ?
    >
    >
    > Any clue is much appreciated !
    >
    > Cheers,
    > Ralph
    >[/color]

    Comment

    • ralphsieminsky@hotmail.com

      #3
      Re: Misc linker errors when moving to /clr

      Thanks for this, bonk. The workaround did not work for
      me but the comments helped me get a version to compile
      ....in Release Mode. All the issues have disappeared.

      So the linker problems seem to apply to Debug Mode only.

      For information, in Debug Mode I also had other
      unresolved tokens, for symbols that happened to
      be #included through header files but actually
      not referenced in the code. Putting the linker
      in verbose mode revealed that it was looking for
      those symbols during a "Search transition" phase.
      Thus possibly the linker is trying to resolve more
      symbols than required in Debug Mode.

      Cheers,
      Ralph

      bonk wrote:[color=blue]
      > I had a similar (maybe the same ?) issue but with VS 2005 Beta 2.
      > It is described here:
      > http://lab.msdn.microsoft.com/produc...4-54741ae3f773
      >
      > Now it also says there this bug is resolved in a later build after Beta
      > 2. Now I am quite shocked that this might not be the case since you are
      > using VS 2005 RC. However it seems that I found a workaround wich I
      > reported here:
      > http://lab.msdn.microsoft.com/Produc...ID=FDBK27870#1
      >
      >
      >
      > ralphsieminsky@ hotmail.com schrieb:[color=green]
      > > A project compiles fine under VS 2005 RC without the /clr
      > > option. However, when /clr is turned on several errors appear:
      > >
      > > - A symbol exported from a DLL is not found by another
      > > DLL referencing it.
      > >
      > > The name of the symbol present in the DLL, as shown by
      > > depends.exe is ?Apply@ScreenCo ntext@@SGPAV1@P AUHWND__@@@Z
      > >
      > > But the name of the symbol the linker looks for when
      > > it tries to build the DLL depending on it is
      > > ?Apply@ScreenCo ntext@@$$FSGPAV 1@PAUHWND__@@@Z
      > >
      > > Strangely enough, the two symbol have exactly the same
      > > undecorated name
      > >
      > > - The second error is the following
      > > mfcs80ud.lib(dl lmodul.obj) : error LNK2005: _DllMain@12 already defined
      > > in msvcrtd.lib(dll main.obj)
      > >
      > > http://support.microsoft.com/default...;en-us;q148652
      > > seems to talk about it, but there is no way I could get
      > > to make its workarounds solve the problem (the instructions don't apply
      > > to VS2005). But why would it manifest itself only in /clr mode ?
      > >
      > >
      > > Any clue is much appreciated !
      > >
      > > Cheers,
      > > Ralph
      > >[/color][/color]

      Comment

      • ralphsieminsky@hotmail.com

        #4
        Re: Misc linker errors when moving to /clr


        Ahem, I'd like to recall my previous message, because
        the /clr option was not applied to all subprojects in
        Release Mode (probably my mistake)...

        The issues are the same in Release Mode as in Debug Mode.

        Cheers,
        Ralph

        Comment

        Working...