Export ?

deadalnix deadalnix at gmail.com
Wed Apr 11 02:56:00 PDT 2012


Le 10/04/2012 19:44, Jonathan M Davis a écrit :
> On Tuesday, April 10, 2012 19:36:06 deadalnix wrote:
>> 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 ).
>
> As I said in the other thread, I _hate_ export. It's one of Windows largest
> misfeatures IMHO. It drives me nuts when I have to deal with it in C++. The
> fact that Linux exports everything is _fantastic_. It's so much easier to deal
> with. I'd _hate_ to see Linux or anything we do move in the direction of what
> Windows has done.
>
> - Jonathan M Davis

It isn't a misfeature. The link explain why it is interesting :
  - It improves load time of DSO.
  - Allow more optimizations.
  - Reduce DSO size by 5% to 20% for C++. Considering how long mangling 
are in D, probably more for us.
  - Reduce name collision (this one poorly apply to D, because the 
module system handle that quite nicely).

Additionally, it allow automatic finalization for non exported methods in D.

The drawback is having to explicitely export. I think it worth it, 
especially considering « export: » is an available solution. A compiler 
switch is also an option.

BTW, Linux is moving in that direction, for the advantages given above. 
Some other posix systems also does that already.


More information about the Digitalmars-d mailing list