Jump to content

View more

Image of the Day

WIP title screen for #DeathOfAPartisan #screenshotsaturday #gamedev https://t.co/qJNhfZCvd4
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Static variables inside a class in a dll?

4: Adsense

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   

925
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?



#2 Paradigm Shifter   Members   

5832
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   Members   

4298
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   

925
Like
0Likes
Like

Posted 17 August 2013 - 12:19 PM

solved with __declspec(dllexport)






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.