__gshared and static constructors

Mike Parker aldacron at gmail.com
Wed Jan 4 20:56:36 PST 2012


On 1/5/2012 4:14 AM, Alex Rønne Petersen wrote:
> Hi,
>
> When using __gshared for variables at module level, it is my
> understanding that they should be initialized in the shared static this
> constructor. My question is: When having __gshared variables inside
> classes, where should I initialize these? Do classes have a shared
> static this constructor?
>
> - Alex

Yes. You can also use a module constructor, since all class members are 
be visible to the module.


More information about the Digitalmars-d-learn mailing list