Export and Protected Scoping in Dynamic Libraries

Rainer Schuetze r.sagitario at gmx.de
Mon Dec 19 04:08:36 PST 2011

On 17.12.2011 20:50, Walter Bright wrote:
> On 12/17/2011 11:22 AM, Adam Wilson wrote:
>> On Sat, 17 Dec 2011 01:33:33 -0800, Walter Bright
>> <newshound2 at digitalmars.com>
>> wrote:
>>> It isn't necessary to export a protected symbol in order to override it.
>> I see, that's a neat little trick. +1 for D!
> C++ works the same way.

You still need the protected symbol if you want to call the base class 
implementation through "super", or if you do not override the protected 
function in the derived class, so the base class member function needs 
to be placed into the vtbl of the derived class.

>> I know DLL's are relatively new to D so not much documentation exists
>> about how
>> they work in D. I think this would be something good to document,
>> especially the
>> special behaviors for Windows. I have to admit that, coming from a C#
>> and C++
>> background, I've been a little confused by how the scope system works in
>> relation to dynamic libraries and have been shooting the dark trying
>> to figure
>> it out. Thanks for the clarifications! Hopefully this lesson will
>> become part of
>> the D lore surrounding dynamic libs. :-)
> DLL's have been supported in D forever, but hardly anyone uses them, and
> sometimes they get bit rotted.
> I strongly recommend Jeffrey Richter's book "Advanced Windows" for a low
> level and lucid explanation of how DLLs work.

sharing D objects across DLLs (as you will obviously need when deriving 
classes in another DLL) is not well supported, a stab at sharing phobos 
as a test bed can be found here: 
http://d.puremagic.com/issues/show_bug.cgi?id=4071, but it is probably 

More information about the Digitalmars-d mailing list