DLLs and static members

K

Kalle Rutanen

Hi there

Why is it that this code fails (in assert) ?
I have VS.NET2003.

(The code below is to give an idea, it's not complete code)

class A{
public:
static long i;
};

long A::i = 2;

int main()
{
dll_function();
assert(A::i == 1);
}

In a dll:

void dll_function()
{
A::i = 1;
}

Seems like the DLL has it's own static variable for the class A ?
 
W

WW

Kalle said:
Hi there

Why is it that this code fails (in assert) ?
I have VS.NET2003. [SNIP]
Seems like the DLL has it's own static variable for the class A ?

Yes it seems. But since DLLs are off-topic here you will need to ask your
further questions in a VC++ newsgroup.
 
J

Jan Dik

I ran into exactly the same problem (see my posting titled 'static const
class member' from 17-10)...

Don't know how to solve this one; posted it in microsoft.publc.vc.* too, but
it seems nobody ever reads that group cos I haven't gotten a reply yet... :(

Jan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,825
Members
47,371
Latest member
Brkaa

Latest Threads

Top