[Issue 9816] Export is mostly broken

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 29 19:29:14 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9816



--- Comment #21 from Martin Nowak <code at dawg.eu> 2013-08-29 19:29:11 PDT ---
To summarize the alias proposal.
For every exported function definition we also emit an alias symbol
_imp_funcname.
For every exported data definition we emit a weakly linked read-only pointer T*
_imp_var = &var.

Whenever an exported symbol is called or accessed this is done using the _imp_*
symbol.
When such code gets linked with an import library it will correctly work with a
DLL.
When such code gets linked with a static library it will reference the correct
definitions.
The simple export attribute is sufficient for all use-cases, no worries about
dllimport/dllexport/no-op.
If we were able to use whole program optimization the linker could optimize
away the additional data access indirection when linking statically.

I don't think the last point is too critical because exporting data is rarely
done and rather a bad practice.
Also this only applies to the API boundary which shouldn't be a performance
hotspot.

For ELF export should simply make a symbol visible, otherwise symbols should be
hidden by default.

Any ideas about Mach-O? Same as ELF?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list