Jump to content
  • Advertisement
Sign in to follow this  
noatom

Static variables inside a class in a dll?

This topic is 1893 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement

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...

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!