Export and Protected Scoping in Dynamic Libraries

Walter Bright newshound2 at digitalmars.com
Fri Dec 16 01:34:32 PST 2011


On 12/14/2011 11:41 AM, Adam Wilson wrote:
> Hello Everyone,
>
> I want to start this conversation by pointing out that I come from a C/C++/C#
> background and my ideas and frustrations in this post will be colored by that
> history.
>
> When I first approached D, the idea of an 'export' confused me. I've since
> figured out, at least in libraries, that in C# terms D's 'export' means
> 'public'.

I'm not too familiar with C#'s public, but what D 'export' means is a function 
is an entry point for a DLL. In the Windows world, that means it gets an extra 
level of indirection when calling it, and it corresponds to:

    __declspec(export)

in Windows compilers.

> However, this raise a problem, specifically, how do I export a
> protected member from a dynamic library?

Do you mean how does one directly call a protected function inside a DLL from 
outside that DLL, without going through the virtual table?


More information about the Digitalmars-d mailing list