1

I created a simple dll in VS2010 with the following function:

extern "C"
{
  __declspec(dllexport) int myFunc()
  {
    return 1;
  }
}

I compared the generated dll and lib files for both x64 and Win32 platforms and I found a result I don't understand.

Using Dependency Walker I see that both dlls will show undecorated "myFunc". When opening both lib files in Notepad++ though, the Win32 lib shows "_myFunc" when the x64 shows simply "myFunc".

Could somebody explain me why the lib signatures are different? Is it possible to remove the underscore in the 32-bit lib file?

  • http://stackoverflow.com/a/15664100/17034 – Hans Passant Aug 24 '15 at 17:01
  • Well I'm completely new to name decoration so your link was interesting Hans. I made some further research and found on this page (https://en.wikipedia.org/wiki/Name_mangling) that "the 64-bit convention on Windows (Microsoft C) has no leading underscore". – Christophe Messaouik Aug 25 '15 at 08:53

1 Answers1

-1

The signature is what is, you cant (or shouldnt) change it with an editor

The libs are diferent because one is for 32 bits and the other for 64

Remenber that a dll generates a .lib but it is only for your use when compiling, the important part is the dll itself, you can delete the .lib an execute the .exe without problems

Juan
  • 178
  • 2
  • 6
  • I'm not convinced that this really answers the question. – Lightness Races in Orbit Aug 24 '15 at 18:04
  • You are talking about the .lib and the .lib doesnt matther at all, the important part is the dll and you saw that both, the 32 and 64 bits, has the same signature so the .exe will not fail either if it uses 32 or 64 bits dll. Why botther about something that it is irrelevant? VS will link it for you and maybe the underscore means others optimizations options and other compilers options that dependes of the .lib – Juan Aug 25 '15 at 01:21