Optional name mangling

Walter Bright newshound2 at digitalmars.com
Sun Jul 22 00:00:49 PDT 2012


On 7/21/2012 11:45 PM, Daniel Murphy wrote:
> The problem isn't that D is mangling names it shouldn't, the problem is that
> your import library uses the wrong mangling for the internal names of
> imported symbols.  Using the .def file with implib is the correct solution,
> unless you want to try converting a coff import library to omf (I've never
> got that to work).  The reason implib needs a def file to work correctly is
> because only the exported name is stored in the dll, not the mangled name.

This is a very old issue. To be compatible with the output of the Microsoft C 
compiler, the Windows calling convention is:

    _name at nn

but somehow Microsoft left off the _ and @nn in the DLLs. Hence, part of the 
whole reason for the import libraries is then to provide a mapping of _name at nn 
=> name.

I have no idea who made this decision and why, but we're stuck with it.




More information about the Digitalmars-d mailing list