Jump to content

  • Log In with Google      Sign In   
  • Create Account


Static variables inside a class in a dll?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 noatom   Members   -  Reputation: 759

Like
0Likes
Like

Posted 17 August 2013 - 07:44 AM

So I have a class inside a dll that has as a member variable a variable from another class in another dll.

That variable was private and the project compiled  fine,now I made it static and public and I get linking problems(with the dll of the class of the static variable).

 

Should static variables inside a dll have a special declaration? Like,__declspec(dllexport) is for functions?


Alexander Turda - The place where I talk about games, coding, movies, and whatever passes through my mind.


Sponsor:

#2 Paradigm Shifter   Crossbones+   -  Reputation: 5092

Like
0Likes
Like

Posted 17 August 2013 - 07:51 AM

You need to use __declspec(dllexport) for exported static/global variables too.

 

There may be issues if you want to share the SAME static variable amongst multiple clients of the DLL though, I'd have to check if that actually works...


"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

#3 Nik02   Crossbones+   -  Reputation: 2629

Like
0Likes
Like

Posted 17 August 2013 - 09:02 AM

There may be issues if you want to share the SAME static variable amongst multiple clients of the DLL though, I'd have to check if that actually works...

 

It is possible to share data sections of a dll, but this is usually not recommended because of potential security issues.


Edited by Nik02, 17 August 2013 - 09:08 AM.

Niko Suni


#4 noatom   Members   -  Reputation: 759

Like
0Likes
Like

Posted 17 August 2013 - 12:19 PM

solved with __declspec(dllexport)


Alexander Turda - The place where I talk about games, coding, movies, and whatever passes through my mind.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS