How to share a variable Between two MfC Dlls?

Hello Friends
I m creating two dll in MFC.I want to share a varible between two.I Exported from one DLL by specifying _declspec(dllexport) int temp = 20;
in header file.

And I copy the .dll and .lib file in second dll (debug folder and also header file of first dll to second dll.I also specify the .lib file in the link path in project settings of second dll.I imported in second dll by __declspec(dllimport) int temp;

Now the problem is If i made any changes on temp variable in first dll then it is not updating in second dll,the second dll always considering temp as 20.
Please suggest me some solution or m i doing some wrong?
Please reply soon.
Thanks In advance


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion