DIP45: fixing the dllimport/dllexport issue

Martin Nowak code at dawg.eu
Thu Aug 29 12:20:18 PDT 2013


On 08/29/2013 09:12 PM, Martin Nowak wrote:
> On 08/29/2013 12:03 PM, Benjamin Thaut wrote:
>> But what if you import a module that is linked statically? That would
>> mean export would be treated as dllimport and it will fail to link
>> because the _imp_ symbols are missing when linking statically?
>
> Could we create alias symbols?

Indeed this seems to work.
OMF has an ALIAS record (http://www.azillionmonkeys.com/qed/Omfg.pdf)
and COFF has weak externals (http://blog.omega-prime.co.uk/?p=121).

So we could add _imp_* aliases for every exported symbol.
When someone links against the import library they are never used, when 
someone links against a static library they redirect to the actual 
definitions. Would that work?


More information about the Digitalmars-d mailing list