10-03-2013 12:33 PM
I am having issues using DeclareThreadSafeScalarView. In my header file I have the following:
DeclareThreadSafeScalarVar (int, RunUserInterface);
I have two different source files with procedures I would like to refrence the variable 'RunUserInterface'. In one file where my
thread is created, I first make a call to 'InitializeRunUserInterface()' and 'SetRunUserInterface(0)' in one procedure, and in
another procedure in that file I call 'GetRunUserInterface()'. In the second source file I have the call 'SetRunUserInterface(1)'.
Both files compile ok, but when the linking of the executable in CVI takes place, I receive link errors saying there are instances
of 'Undefined symbol' for each one of the calls made. I have looked through the CVI Help screens and do not see what I
may be doing incorrectly. Can anyone answer why I may be having these link errors?
Solved! Go to Solution.
10-03-2013 12:48 PM
RunUserInterface is a function in your program. You cannot have a variable with the same name as a function.
Are you really trying to manipulate a variable or are you trying to do something else treating RunUserInterface as a thread safe variable?
10-03-2013 12:53 PM
RunUserInterface is the variable name in my DeclareThreadSafeScalarVar declaration in my header file. I don't have a function
with this name. My intent is to have a thread safe variable to manipulate from two different source files.
10-03-2013 02:15 PM
I just happen to google and find another forum on the DeclareThreadSafeScalarVar usage and stumbled on my problem. The NI
manuals did not state the usage of this with the DefineThreadSafeScalarVar statement. I made an assumption that if I did one
then I was covered. I did not realize that the two statements need to be used together. The declare statement in the include file
and the define statement in the source file where the InitializeVar is used. I place the define in my source and built my executable
without any link errors. Thanks for your earlier response.