DLL symbol identity

Paulo Pinto via Digitalmars-d digitalmars-d at puremagic.com
Mon May 11 13:07:56 PDT 2015


On Monday, 11 May 2015 at 15:32:47 UTC, Benjamin Thaut wrote:
> On Monday, 11 May 2015 at 14:57:46 UTC, Marco Leise wrote:
>>
>> Is that what would happen?
>
> Yes, that's exactly what would happen. You could go one step 
> further and not do it for all symbols, instead you make the 
> compiler emit a additional section with references to all 
> relevant data symbols. Then you only do the patching operation 
> on the data symbols and leave all other symbols as is. This 
> would greatly reduce the number of symbols that require 
> patching.
>
> The exepcted data set size should be significantly smaller then 
> on linux. Because currently on linux D simply exports all 
> symbols. Which means that the linux loader does this patching 
> for all symbols. On windows only symbols with the "export" 
> protection level get exported. That means the set of symbols 
> this patching has to be done for is a lot smaller to begin 
> with. The additional optimization would reduce the number of 
> symbols to patch once again. So even if the custom 
> implementation is vastly inferior to what the linux loader does 
> (which I don't think it will be) it still should be fast enough 
> to not influence program startup time a lot.


Just as info, Windows is not alone.

There are a few other systems that follow the same process.

For example, Aix used to be Windows like and nowadays it has a 
mix of ELF and Windows modes.

http://www.ibm.com/developerworks/aix/library/au-aix-symbol-visibility/

Symbian although dead, also used the Windows approach if I 
remember correctly.

I expect other non-POSIX OSes not to follow the ELF way.

--
Paulo


More information about the Digitalmars-d mailing list