My guess is that class variables (‘class var’) are truly global in storage (that is, one instance for the entire application).
But I am wondering whether this is the case, or whether they are thread in storage (eg similar to a ‘threadvar’) – once instance per thread.
Anyone know?
Edit: changed ‘scope’ to ‘storage’ as this is in fact the correct terminology, and what I am after (thanks Barry)
Yes, class variables are globally scoped. Have a look in the RTL source for details of how threadvars are implemented. Under Win32 each thread can have a block of memory allocated automatically to it on thread creation. This extra data area is what is used to contain your threadvars.