473,414 Members | 1,686 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

change in Variable Value

Hi,
I am declaring a variable
static char Version_No = '1' in header file header.h
In a application "app.exe", i am changing the value of the
variable in to '2'

In the same application i am calling an function fun1()
which is in another dll, MYDll.dll(which is linked
implicitly to the exe) which includes the same header file
header.h

When i use the variable Version_No in this function fun1(),
the change i made in the executable is not reflected in the
dll function.
i.e. when i access the variable Version_No in the function
fun1(), i am getting a value of '1' inshead of '2' . can u
help me in solving this problem.

If i want the change in the variable value to be reflected
in the application what is the change i need to do.

-Thanks in Advance
Varadha
Nov 16 '05 #1
1 1703
Varadha wrote:
Hi,
I am declaring a variable
static char Version_No = '1' in header file header.h
In a application "app.exe", i am changing the value of the
variable in to '2'

In the same application i am calling an function fun1()
which is in another dll, MYDll.dll(which is linked
implicitly to the exe) which includes the same header file
header.h

When i use the variable Version_No in this function fun1(),
the change i made in the executable is not reflected in the
dll function.
i.e. when i access the variable Version_No in the function
fun1(), i am getting a value of '1' inshead of '2' . can u
help me in solving this problem.

If i want the change in the variable value to be reflected
in the application what is the change i need to do.


You have two variables named Version_No - one in the EXE and one in the DLL.
Indeed, since you declare the variable as static, you may have many copies
of the variable - a distinct copy in each translation unit (.c or .cpp file)
that includes the header file.

While it's possible to share data between an EXE and a DLL, it's generally
not a good design. Better to rely on exported functions to access/modify
the shared data.

-cd
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Richard Cornford | last post by:
For the last couple of months I have been trying to get the next round of updates to the FAQ underway and been being thwarted by a heavy workload (the project I am working on has to be finished an...
3
by: Byron | last post by:
Hi, Javascript confuses me, so I usually limit myself to Dreamweaver's built-in scripts for stuff like imageswaps. But this time I'm trying to write something very simple myself. I do most of my...
0
by: Anonieko Ramos | last post by:
Answer. Use IHttpHandler. thanks Ro ry for coming up with this code. It processes css file to add variables. neat idea using System; using System.IO; using System.Text; using...
4
by: Shapper | last post by:
Hello, I have this image in my HTML code: <img src="images/en-US/myImage.jpg" /> I want to change the URL using the value of a Session variable. <img src="images/ Session("culture") Value...
0
by: josemario.hernandez | last post by:
Hi, I'm having a issue trying to change the value of a session variable. It seems like I just can set my session variable one time in the sessión. For example if I write: Session("Variable") =...
5
by: Maxwell2006 | last post by:
Hi, Can I have a breakpoint that stop execution as soon as any code change the value of a specific variable? Thank you, Max
3
by: vatsa | last post by:
Hi all, we can simply change value of PS1 from command prompt . but I want to change the value of PS1 from within a c program. i tried to do that using getenv & putenv. but it is n't...
7
by: dotnetnoob | last post by:
i keep getting Object references not set to an instance of an object from this code: Private Sub EqBinding() Dim x As Integer x = 0 Do If CStr(arlsType.Item(x)) = "Bacnet Point" Then Dim...
3
by: tc | last post by:
I'm trying to put together a small control. It's not, but for arguments sake, let's say it's a progress bar. The user will make a change to a setting, lets call it 'value'. I want to trap the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.