NO

Author Topic: [polink] "Symbol multiply defined" while symbols are uniques  (Read 3255 times)

Mod

  • Guest
[polink] "Symbol multiply defined" while symbols are uniques
« on: October 12, 2008, 02:22:04 PM »
Hi,

I've recently met a problem with polink when trying to link a .obj file (ASM) with a static library compiled using Visual C++ 2005 Express (C compilation mode, no choice to use anything else than VCE).

At the beginning, I was thinking that the problem was coming from VCE, but after long hours of debugging, I think now that it is a problem in polink.

When I create some switch/case in my static library code, it generates labels like $LN1@function, $LN2@function, etc, one for each case. I can see these names in the ASM listing output of the library.
If I have only one switch/case in my library, no problem, but if I have two switch/case or more, the problem is that when I try to use polink with this static library, it detects some duplicated symbols :

Code: [Select]
POLINK: error: Symbol '$LN2' is multiply defined: 'Switch.lib(Debug.obj)' and 'Switch.lib(Debug.obj)'.
And when I take a look to the ASM source, there are no $LN2 symbol, but $LN2@function1 and $LN2@function2 labels.

The C code of the library is that (example) :

Code: [Select]
extern int SwitchTest(char op)
{
int value;

switch (op)
{
case 0:
value = 1;
case 1:
value = 2;
case 2:
value = 3;
case 3:
value = 4;
default:
value = 0;
}

return value;
}

extern int SwitchTest2(char op)
{
int value;

switch (op)
{
case 0:
value = 5;
case 1:
value = 6;
case 2:
value = 7;
case 3:
value = 8;
default:
value = 0;
}

return value;
}

Here is an archive with all the files needed to reproduce the problem : http://rapidshare.com/files/153267174/SwitchSymbols.rar.html.
- SwitchLib.c, the code for the library.
- SwitchLib.lib, the compiled library.
- Test.asm, a simple code using SwitchLib.lib (FAsm syntax).
- Test.obj, the compiled code.
- msvcrt.lib, libcmt.lib, and oldnames.lib.

To link, I use the following command line :

Code: [Select]
polink test.obj msvcrt.lib switchlib.lib /SUBSYSTEM:console /ENTRY:_main
« Last Edit: October 12, 2008, 02:39:56 PM by Mod »

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: [polink] "Symbol multiply defined" while symbols are uniques
« Reply #1 on: October 15, 2008, 07:25:01 PM »
OK, I will look at it when I can...
/Pelle