Export ?

deadalnix deadalnix at gmail.com
Tue Apr 10 10:36:06 PDT 2012


On this newsgroup with Jonathan M Davis, we started discussing export. 
As it was off topic, and as it was interesting, I wish to bring it here.

As most of you know, all symbol on posix systems are export, but not on 
windows. As D have an export keyword, the question is what to do with it.

The need for change in the UNIX world of this behavior exists, and some 
move has been made in direction of explicitly hiding symbols ( see 
http://gcc.gnu.org/wiki/Visibility ).

For consistency across systems, I suggest that, unless marked as 
exported, symbols are hidden by default. This have other advantages as 
shown in the linked page about gcc. For D, it also mean that the linker 
will have all information to finalize all methods that are not marked as 
export, and I think this is something we want to mitigate the cost of 
all methods virtual by default.

The site says : « Ex­port means that any code out­side the ex­e­cutable 
can ac­cess the mem­ber. Ex­port is anal­o­gous to ex­port­ing 
de­f­i­n­i­tions from a DLL. » so, clearly it is not saying anything 
about posix systems (you'll not find many DLL on those) and not what D 
compiler does.

It means that export comes as an extra qualifier, and not as an 
alternative to public/private/protected/package . You can be both export 
AND public/private/protected/package .

This already have been discussed here, but no conclusion has been made.


More information about the Digitalmars-d mailing list