Optional name mangling

Sean Kelly sean at invisibleduck.org
Sun Jul 22 08:31:36 PDT 2012


On Jul 22, 2012, at 6:12 AM, "Stuart" <stugol at gmx.com> wrote:

> On Sunday, 22 July 2012 at 07:01:50 UTC, Walter Bright wrote:
>> 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.
> 
> Okay, but if you had a keyword - say, "extern(rawC)" - that did no mangling whatsoever, then I could run implib without manually editing every single damn line in every Microsoft .def file by hand!!! Surely that's a good idea?
> 
> I don't know why implib is ignoring the /s switch, but it is. My .lib file doesn't have underscores, and there doesn't seem to be much I can do about it. Do I need a different version of implib or something? Shouldn't the /s switch add underscores to everything?

I think there's definitely some use in being able to specify a symbol name as a string, both for aliasing external symbols and overriding name mangling of internal symbols. 


More information about the Digitalmars-d mailing list